View Single Post
 
Old 02-18-2016, 06:35 PM
Marrick13 Marrick13 is offline Windows XP Office 2010 32bit
Competent Performer
 
Join Date: Jun 2006
Posts: 102
Marrick13 will become famous soon enough
Default

I realze the caret mans you want to keep the following letters, as in "keeping" them in a replace situation. I was looking at them to identify whole word matches, so I presume if he code detects a letter or number before or after the search text it finds, it should regard that hit as NOT a whole word match. However, if the hit has punctuation or a special character on either adjacent side, such as a comma, $, !, :, etc., I think it should regard the term as a whole word and extract it. I tried plugging that long pattern above into the code and got syntax errors, and it's too many characters for me to figure out what's wrong with it. But I do know that if I run the code with .Pattern = "[^A-Za-z0-9\ ]", it ignores all hits that have a dash (or hyphen) before or after the search term (without spaces). That's what I'm after - how to get the code to accept hits with adjacent punctuation or special characters as whole word matches. I still don't know how to get there.
Reply With Quote