Regex: word boundaries -
i have search words containing capitalized letters or numbers.
i use \b[^ ]*[a-z0-9]+[^ ]*\b
, instead of [^ ]
use [^\b]
, selects phrase...
this
is
some
text, has
s0me
num8ers
, like
boeing-380
or
rna-78
.
that
is
great!
you may use \w*
matching 0 or more word characters.
\w*[a-z0-9-]+\w*
or
\s*[a-z0-9]+\s*
and note can't include \b
, \b
inside character class. achieve result without including both inside character class through other ways. \s*
matches 0 or more non-space characters.
Comments
Post a Comment