How would I search for a word using regular expressions?

R

RedRado03

I need to search for all whole words and whole words words that also contain
hyphens.
For example: B1-B2

This is what I have so far..

<([A-Za-z0-9][A-Za-z0-9]*)>
 
R

RedRado03

I reviewed the site but, still cant find how to search for all words
containing a hyphen or without.

Jay Freedman said:
See http://www.gmayor.com/replace_using_wildcards.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
I need to search for all whole words and whole words words that also
contain hyphens.
For example: B1-B2

This is what I have so far..

<([A-Za-z0-9][A-Za-z0-9]*)>
 
T

Tony Jollans

To put a hyphen in your pattern you need to escape it with a backslash ...

<( [\-A-Za-z0-9]{1,})>

(untested - but should work unless the hyphens conflict with the word starts
and ends)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top