Shameless Plug – Regular Expression in ABAP Book
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:
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.
Thanks n_n
Thanks -:) And according to my research, it's available starting on NetWeaver 2004s...but you can test the simple REMOVE HTML example and find out -:)
Greetings,
Blag.
[Source of the famous "Now you have two problems" quote]
I find the example quite useful - especially for mobile device rendering and readability scenarios.
Kudos!
Sure, I'm not going rich with the books selling, but at least it's enough to put some credits on Skype every month -;)
I like that quote -:P RegEx can be a real pain if you don't know how to use it...and it can grow so big that you would get yourself lost at some point...but I guess that's the fun of ABAP development...biggest challenges and weird solutions -;)
I liked the HTML example too...that's why there are two more examples about that in the book -:) Including also both XML parsing and generation...which I like to call "My little monsters" LOL
Greetings,
Blag.
Ulli