I have to search words containing capitalized letters or numbers.
I use \b[^ ]*[A-Z0-9]+[^ ]*\b
, however instead of [^ ]
i would like to use [^\b]
, but this selects all the phrase...
This
is
Some
text, that has
s0me
nUm8ers
, like
Boeing-380
or
RNA-78
.
That
is
GREAT!
You may use \w*
for matching zero or more word characters.
\w*[A-Z0-9-]+\w*
or
\S*[A-Z0-9]+\S*
And note that you can't include \b
, \B
inside a character class. You could achieve the result without including the both inside a character class through some other ways. \S*
matches zero or more non-space characters.