I have a document that has (TL by user) all over the place. I'd like to replace this with nothing (thereby deleting it everywhere) but the user could be different or there could be many users (TL by user1) (TL by user3, superuser1). So far I have tried find (TL by .*) and replace with nothing but that gets rid of everything but the user and the surrounding paranthesis for some reason so I'm left with (user1) or (user3,superuser1). How can I get the regex to match and replace the entire match (TL by user) including the parans and everything inside?
This is on Word 2010, I will put more information when I get home later today
Answer
There is no actual "RegEx" searching in Office, but you can use the "Use Wildcards" option.
So since it's not real RegEx, the .
doesn't do anything to help. You just need the *
wildcard.
The next trick is that while performing a wildcard search in Word, the brackets ()
are used for grouping (like in RegEx), so if you want to search for literal brackets you need to escape them with a backslash (\
).
Putting all that together and I end up with this Find command, which works as you want (based on my testing):
\(TL by *\)
Find and Replace dialog settings I used:
No comments:
Post a Comment