December 2012
Intermediate to advanced
316 pages
6h 51m
English
In this recipe, we will use the start and end of word operators along with the subgroup register placeholders in order to write a program that will remove adjacent duplicate words from a text string. For example, from the text 'this this is is a repeated text text 11 11', the duplication of words will be removed and the new text 'this is a repeated text 11' is given as the output.
In order to create a repeated word removal program, proceed as follows:
textstream string. Then assign some text to it that has repeated words in it.replace all occurrences statement is then written with the regular expression (\<\w+\>) \1. The replacement key is '$1'.if statement is then used for ...Read now
Unlock full access