Reputation: 555
i just wanted to check through regular expressions if my string contained the word TSS at the start...e.g TSSProd or TSSRelease1...if TSS occurs anywhere in the middle or at the last it should return false...Please help as i have no knowledge of Regular expressions.Thanks in advance
Upvotes: 0
Views: 49
Reputation: 141839
Use
var patt = /^TSS/
if(patt.test(mystring)){
alert(mystring+' begins with TSS!');
}
patt.test(mystring)
will return true if mystring begins with TSS and false otherwise.
Upvotes: 2