All of the examples up to this point have been destructive though.
Wrong.
If the /d modifier is used, the REPLACEMENTLIST is always interpreted exactly as specified. Otherwise, if the REPLACEMENTLIST is shorter than the SEARCHLIST, the final character is replicated till it is long enough. If the REPLACEMENTLIST is empty, the SEARCHLIST is replicated. This latter is useful for counting characters in a class or for squashing character sequences in a class.
(Underline mine.)
Makeshifts last the longest.
In reply to Re^2: Counting how many times a character is in a string.
by Aristotle
in thread Counting how many times a character is in a string.
by slloyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |