-
Book Overview & Buying
-
Table Of Contents
SAP ABAP Advanced Cookbook
By :
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:
Declare the textstream string. Then assign some text to it that has repeated words in it.
A replace all occurrences statement is then written with the regular expression (\<\w+\>) \1. The replacement key is '$1'.
The if statement is then used for checking the return code. For sy-subrc having the value 0, the message Number is Valid is displayed.

The regex used in this recipe is different from that used in the previous one. Since we require searching of duplicate words rather...
Change the font size
Change margin width
Change background colour