mcgrailm
mcgrailm

Reputation: 17638

regex ensure string starts with

I need a regex that will ensure the the user input looks like this "auth+live+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' Where x is alpha numeric so I got the alpha numeric done like so

/^[a-z0-9]+$/i

How do I ensure that input starts with auth+live+ ?

any help would be greatly appreciated

Upvotes: 3

Views: 7029

Answers (2)

Madara's Ghost
Madara's Ghost

Reputation: 175007

How about

/^auth\+live\+[a-z0-9]+$/i

Upvotes: 4

jfriend00
jfriend00

Reputation: 707716

I think this does what you're asking for:

/^auth\+live\+[a-zA-Z0-9]+$/

Upvotes: 7

Related Questions