Regex: match any word in a string that starts with "qwe"
Say there are some strings
"abc qwe xyz"
"qwe abc xyz"
"abc xyz qwe"
"abc 123 zyx"
How to write an expression to locate the strings that contain words beginning with "qwe"
?
(first 3 lines in our cas开发者_StackOverflow社区e)
Try this:
\bqwe
The \b
matches at a word boundary (the start or end of a word).
in perl regex:
/\bqwe/
or, for ABC (case insensitive):
/\babc/i
where \b
means 'word boundary'.
精彩评论