JeffHe23
JeffHe23

Reputation: 3

Validate that string starts with at least two hyphens then only consists of alphanumeric characters

I have a string that can look in the following ways:

----4dfd650c9f65              match
-----473ffd650c9f65           match
-----473ffd650c9f65s3--       does not match
--473577f2hd650c9f65--        does not match

I would like to match if and only if starts with at least two -- and ends on \n but does not ends with --.

Upvotes: 0

Views: 271

Answers (1)

Vivin Paliath
Vivin Paliath

Reputation: 95508

Something like this should work:

/^-{2,}[0-9A-Za-z]+$/

Upvotes: 4

Related Questions