REGEXP and expressions beginning at start of string or with a separator
I'd like a REGEXP that only picks up a substring that either starts at the beginning开发者_JS百科 of the string or is preceded by a space or separating character. How does this work?
For example,
[ _^]Smith
seems to be almost it!
(^|[ _])Smith
^ (start) or one of [ _] followed by Smith
(| is the or operator)
Something like this:
^[ _]?Smith
^- beginning of line
[ _]? - space or underscore 0 or one time
加载中,请稍侯......
精彩评论