Reputation: 88
I need to find all the words that have the specific characters(letters, numbers and special characters) and ignore the rest.
Here's my expression:
/[cwh]\w+/ig
Example:
Match: watch, because c
, w
aswell as h
is present in that word
Skip: Welcome, because only c
and W
is present
The expression need match case insensitive.
Thank you very much for your help.
Upvotes: 3
Views: 2040
Reputation: 22
I'm not sure exactly what your match rules are - since both watch (lowercase w) and Welcome (lowercase c) would match the characters in your list. But
\w*[cwh]\w*/g
is probably what you're after.
This will match zero or more word characters, one character from your list, and zero or more word characters in a case sensitive fashion (w is distinct from W) globally (multiple matches possible per line).
Upvotes: 0