Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-30-2021, 04:33 PM
Steve Kunkel Steve Kunkel is offline "Alternation" with Find-n-Replace wildcards? Windows 10 "Alternation" with Find-n-Replace wildcards? Office 2019
Advanced Beginner
"Alternation" with Find-n-Replace wildcards?
 
Join Date: May 2019
Location: Seattle area
Posts: 81
Steve Kunkel is on a distinguished road
Default "Alternation" with Find-n-Replace wildcards?

Do you guys know if this is possible? I'm using VBA, though I guess this isn't a VBA question, per se. The top three are working regular expression setups from another project. I'd like to recreate those in my Word VBA project.

With the bottom three, the first two are working setups, but the very bottom one doesn't work because "(s|z|sh|ch|x|o)" seems to match any single character in the range.

I think what I'm looking for is called "alternation?"

For example I'd like this "xxx(s|z|sh|ch|x|o)es" to match
xxxches
xxxshes

but not match


xxxces

Is this possible?


PERL regular expression.
Code:
Find "s)([Tt]hey\s)(.*?)ies\b" and Replace with "$1$2y"
Find  "s)([Tt]hey\s)(.*?)s\b" and Replace with  "$1$2" 
Find  "s)([Tt]hey\s)(.*?)((s|z|sh|ch|x|o))es\b" and Replace with "$1$2$3"
Word Wildcards
Code:
Find "([Tt]hey )([a-z]@)ies" and Replace with  "\1\2y"
Find  "([Tt]hey )([a-z]@)s"  and Replace with  "\1\2"
Find  "([Tt]hey )([a-z]@(s|z|sh|ch|x|o))es"  and Replace with  "\1\2"
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Find and Replace" tool leaves out many of the occurrences of what I put in the "find" window Swarup Word 8 06-24-2021 08:31 PM
"Alternation" with Find-n-Replace wildcards? Rebinding "Ctrl+F" to bring up Find & Replace Window in Word 2013 ravl13 Word 4 12-09-2016 02:58 PM
"Alternation" with Find-n-Replace wildcards? Is there a way to use "find/replace" to find italics words? slayda Word 3 09-14-2011 02:16 PM
"Find" Wildcards djreyrey Word 2 03-20-2011 09:36 PM
"Alternation" with Find-n-Replace wildcards? Find & Replace words with "/" prefix & suffix tollanarama Word 4 01-25-2011 02:19 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft