Regular expressions are available in ABAP as of Release 7.0. A regular expression is a pattern of literal and special characters that describes a set of character strings. You use regular expressions to locate or replace one or more occurrences of the character strings represented by the expression in character strings. ABAP supports regular expressions in the statements FIND and REPLACE and via the the classes CL_ABAP_REGEX and CL_ABAP_MATCHER. In an upcoming Release there will be also built-in functions that support regular expressions.
Regular expressions are very powerful but can also become very complicated and are not easy to maintain. Especially finding an appropriate expression for a given task might take some time and then the question remains, how to test it. If you do not want to test your regular expressions only after including them in your application programs and if you do not want to create temporary test programs for each regular expression over and over again, you can use the program DEMO_REGEX_TOY that is delivered as of Support Package 7 of Release 7.0.
The input mask allows you to enter your regular expressions, some text, and to play around with the various options for using the regular expression.
I for myself never use a regular expression in a program without having tested it in DEMO_REGEX_TOY or it’s little brother DEMO_REGEX (available as part of the ABAP Example Library as of Release 7.0, EhP2).