What is the best way find specific pattern using regex?

2178 views regex
3

I need find a word, that start with alphabetic symbol a-zA-Z and then can be continued by alphabetic symbols\digits, unlimited times

Example:
foo123
f3
3foo - ERROR
asd1
asd

using ECMAScript syntax.
Example on this site can be useful: https://regex101.com/

answered question

^[a-zA-Z][a-zA-Z0-9]+$

1 Answer

5

^[a-zA-Z][a-zA-Z0-9]+$

Explanation

^$ - from start to end (match the whole line)

[a-zA-Z] Any letter once

[a-zA-Z0-9]+ Any letter or any number 1 or more times.

posted this

Have an answer?

JD

Please login first before posting an answer.