javascript - Regular Expression to match first and last character -
javascript - Regular Expression to match first and last character -
i'm new using regular expressions , trying utilize regex check first , lastly characters in string alpha characters between a-z.
i know matches first character:
/^[a-z]/i
but how check lastly character well? this:
/^[a-z][a-z]$/i
does not work. , suspect there should in between 2 clauses don't know what!
any help much appreciated.
the below regex match strings starts , ends alpha character.
/^[a-z].*[a-z]$/igm
demo
explanation:
^ # represents begining of line. [a-z] # alphabatic character. .* # character 0 or more times. [a-z] # alphabatic character. $ # end of line. # case-insensitive match. g # global. m # multiline
javascript regex expression
Comments
Post a Comment