Tuesday, 15 June 2010

regex - Confusion with Regular Expression -



regex - Confusion with Regular Expression -

i working on below regex

/^[a-z][a-z0-9_.-]*$/

everything working fine shows,

abc._- abc_02. ab.2_cder

problem - not allowing me come in [._-] characters below. new , beginner in regex.

.any character _any character -any character

/^[a-z][a-z0-9_.-]*$/

with ^[a-z] you're forcing first character of string lowercase letter.

so won't work else.

you can alter regex

/^[a-z0-9_.-]*$/

to create work.

regex

No comments:

Post a Comment