Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member182779
Active Contributor
0 Kudos

After some real hard work (using Regular Expressions in every project I could) I have write and published my Regular Expression in ABAP Book.

 

While is a very small book, it's full with real life example that would help to start in the complex world of Regular Expressions.

 

 

The book can be bought as PDF, EBook and Printed version:

 

PDF

EBook

Printed

 

Small example from the book (as adviced by Jim Spath):

 

Remove HTML
 
I know that this RegEx is not especially useful for an ABAP program…but it may come in handy for a BSP or WebDynpro application.

 

DATA: GV_TEXT TYPE STRING.

GV_TEXT = 'ABAP Rocks!'.

WRITE:/ GV_TEXT.

REPLACE ALL OCCURRENCES OF REGEX '<[^>]+>' IN GV_TEXT WITH SPACE.

WRITE:/ GV_TEXT.

 

 

Explanation: <[^>]+>
We want words starting with “<”.
We don’t want them to be empty, so we use [^>] meaning that if it’s opened by a “<” we don’t want to close them right away.
We want some text inside, and then close them, so we use +>.

 

Hope you like it.

5 Comments