regex - Regular expression for word that not starts with dot -
i need create regular expression word not starting dot , may contains alphabet,space , dot.
ex: sample,sample.test,sample test
regular expression should not allow .sample,sample.,sample .test
how generate regular expression this?
this regex: ^[^.][\p{l} .]+$ should match after.
the ^ anchor instruct regex engine start matching beginning of string. [^.] match 1 character not period (.). [\p{l} .]+ match 1 ore more characters either letter (in language shown here), white space or period. finally, $ instruct regex terminate matching @ end of string.
edit: per comment question, should testable: ^[^.][a-za-z .]+$.
Comments
Post a Comment