Skip to Content
Author's profile photo Alvaro Tejada Galindo

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:

 

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.

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Raul Mosquera Pumaricra
      Raul Mosquera Pumaricra
      Great work!, I have a question, regular expression is available since 4.6? or 6?.

      Thanks n_n

      Author's profile photo Alvaro Tejada Galindo
      Alvaro Tejada Galindo
      Blog Post Author
      Raul:

      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.

      Author's profile photo Matthias Steiner
      Matthias Steiner
      Blag, I think that plug is definately fine and personally I'd call it customer service to your followers. With all you haven been doing and contributing to the communty over the years it's all good to let us know about your book. It's not like you're making a fortune with writing these kinds of books and it's only in best interest to the ecosystem if someone with your reputation is tackling the powerful, yet challenging concept of RegExs:

      Some people, when confronted with a problem, think
      "I know, I'll use regular expressions."   Now they have two problems.

      [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!

      Author's profile photo Alvaro Tejada Galindo
      Alvaro Tejada Galindo
      Blog Post Author
      Thanks Matthias!

      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.

      Author's profile photo Ulli Hoffmann
      Ulli Hoffmann
      Interesting to see that you choose to publish your ideas and expertise using lulu and not through overpriced SAP Press. However, before I decide to buy a book I usually try to get some more data regarding the content. I couldn't find some samples or a table of content. Would that be available somewhere?

      Ulli