If I am looping over files and I want to remove any occurrences of "deez" or "nutz" in the file names, I can write a regex like this:
s/(deez|nutz)//gi;But, if I have a file named "deez blah nutz.txt" only the deez will be replaced. And, if "deez" occurred more times in the string, all of those subsequent occurrences would also be replaced because I used the g modifier. Alternatively, if I have a file named "nuts blah deez.txt", only the nuts will be replaced. Do I have this right?
Is it possible to write a single substitution that will replace all occurrences of both words in a string? I know it can easily be done by splitting the substitution up into two separate regex's, but I'd really like to do this in a single statement, if possible.
Thanks
In reply to Regex "or" by Mad_Mac
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |