Shorter way to write this regex? -


/[a-za-z][a-za-z0-9-]*/ 

is there shorter more concise way write this?

you can use i modifier make case-insensitive, don't have write both a-z , a-z. , can replace 0-9 \d.

/[a-z][a-z\d-]*/i 

there's no escape sequence matches letter, or letters, numbers , hyphen. closest \w, matches letter, numbers, , underscore.


Comments