2018 Sep 06 11:55 AM
Hi all,
May i know how to write regular expression to get the string that starts with > and ends with }
ex: in string : data>/ab/cd/peter} ; prop>/site/sing/perl};
want the string `>/ab/cd/peter}` and `>site/sing/perl}`.
i tried with this but not knowing how place a condition that starts with >
my findings:
(\/(\w+)\/)*(\w+)(@*)(\w+)(~*)((\w+)?)\/(\w+)\}
Regards,
kiran rachamalla.
2018 Sep 07 7:17 AM
For others happening upon this thread, a colleague recently pointed me to a neat demo-program with which REGEX expressions can be tested. It also includes a link to the help documentation:
DEMO_REGEX_TOY
As the name of the program implies you can really play with REGEX with it!
Here is how it looks like for the example given:
Cheers
Baerbel
2018 Sep 06 1:20 PM
2018 Sep 07 7:17 AM
For others happening upon this thread, a colleague recently pointed me to a neat demo-program with which REGEX expressions can be tested. It also includes a link to the help documentation:
DEMO_REGEX_TOY
As the name of the program implies you can really play with REGEX with it!
Here is how it looks like for the example given:
Cheers
Baerbel
2018 Sep 07 10:12 AM
That's really useful. I've been using online REGEX checkers, but you're never sure they're following the same rules as the SAP kernel.
2018 Sep 07 11:25 AM
2018 Sep 07 12:42 PM
2018 Sep 08 7:36 AM
DEMO_REGEX and DEMO_REGEX_TOY are in fact part of the documentation's example library in package SABAPDEMOS and of course mentioned in the text
They are around quite long
https://blogs.sap.com/2009/09/10/abap-geek-14-regular-expressions-made-easy/
They were created exactly for the reasons you give above. In the beginning, DEMO_REGEX_TOY had some flaws regarding the line breaks, that are fixed meanwhile.
2018 Sep 08 4:18 PM
In my defence. I read documentation when I have an issue with how things work.
When I need to check a regex, my first response is to Google "online regex checker". It's not "oh, I must read the abap documentation just in case someone has decided to write a regex checker in abap and has made it part of the abap documentation."
When it comes to my bedtime story, my wife prefers to read me the classics, or Sci fi. She's not so keen on Abap documentation... 🙂
2018 Sep 08 7:51 PM
Uh... and I thought you were joking! As in: Documentation? Nobody who posts on this site is familiar with that concept (apart from Horst).
Then I also noticed I fell into the old ABAP docu trap of copy-pasting the URL and just getting the top level link. Horst's link was the one I meant to post, have corrected mine.
2018 Sep 08 9:30 PM
But what to do else?
It is exactly as you said "someone has decided to write a regex checker in abap and as part of the abap documentation".
That was me, and I am documentation writer. What to do else?
2018 Sep 09 8:39 AM
2018 Sep 09 8:39 AM
2018 Sep 09 10:40 AM
Just wondering: do these Demo-programs/packages qualify as "hidden gems" and should perhaps be highlighted more to make people aware of them? There's just so much "stuff" in a SAP-system that items like these easily fly under people's radar:
A quick search for the demo package found this older blog post by a "former member":
https://blogs.sap.com/2013/07/04/useful-abap-packages-for-demo-programs/
Would perhaps a new blog post along those lines - properly highlighted - help raise awareness?
Cheers
Baerbel
2018 Sep 09 12:46 PM
2024 May 03 10:37 AM - edited 2024 May 03 10:38 AM
Hi mates
i have a doubt, do this Regular Expressions work the same in the country specific value conversion tool? Because i am trying some and are not working but are written in the guides you mention, do you know if it does not accept everything?
Regards