Using StrSubstitute from xstring I can find and replace matches. For e.g.:
\StrSubstitute{I like to eat fish.}{fish}{apples} gives "I like to eat apples."
\StrSubstitute{Do you want to eat?}{eat}{fly} gives "Do you want to fly?"
- How can I adjust this so that the replace only occurs when the matching string not bounded by letters or numbers?
For e.g., when replacing "fish" with "apples":
I like to eat fish. gives "I like to eat apples." (changed)
I like to go fishing. gives "I like to go fishing." (not changed)
@fish are interesting/. gives "@apples are interesting." (changed)
9fish is too many. gives "9fish is too many." (not changed)
In the above cases, the changes did not occur in situations when the letters (A-Z or a-z) or number (0|+) appeared on either side.
l3regexpackage. It provides regular expressions. – Leo Liu Nov 28 '11 at 02:36