Hi there

I have a little function that validates whether a string entered is syntactically correct

function str_validate() {
                        var patt=/^[a-z]{3}w(prd|uat|dev)\d{1}$/;
                        val = document.getElementById("hostname").value;
                        if ((val.length > 7) && patt.test(val)) {
                                   // do some good stuff
                        } else {
                                alert("Invalid string Name");

as you can see I am matching against 8 characters made up of 3 alphas, a 'w', a three character string of 'prd', 'uat' or 'dev' and then a single numeric

what i am looking to do is to extract into a variable the three character string ('prd', 'uat' or 'dev') so that i can use it to work with in another function ...

does anybody know how I would be able to extract this part of the string (its always the 5th,6th and 7th character of the 8 charachter string)

any help would be greatly appreciated