‎2007 Jun 16 1:13 PM
Hi intellectuals,
the new regex functionality is really amazing - but not easy to understand.
Let me try to start a small competition:
Pleas explain in detail the following expression:
DATA:
whatever TYPE string,
matcher TYPE REF TO cl_abap_matcher.
matcher = cl_abap_matcher=>create(
pattern = `w+(.w+)*@(w+.)+(w{2,4})`
text = whatever ).
I'd like to know the evaluation check procedure matcher->match( ). Just imagine what could I put into string whatever to match or not match the expression pattern.
TIA,
Regards,
Clemens
‎2008 Feb 12 3:00 PM
Hey,
maybe this on is a bit late... \w is a group of characters containing any word usually this one \[A-Za-z0-9_\]...
But you may check out this [website|http://www.regular-expressions.info/charclass.html] which i found quite amazing helpfull.
And your code is probably a mailadress...
Edited by: Rumpf Johannes on Feb 12, 2008 4:00 PM
Edited by: Rumpf Johannes on Feb 12, 2008 4:01 PM
‎2008 Jul 25 10:43 AM
OK, I played with REGEX in ABAP. Some drawbacka remain because there is no ISO or other common definition of regualr expressions and the results of more complex expressions may be different for different languages and applications.
For instance MS WORD search & replace with patterns activated interprets regular expressions including back references, ABAP did not support back references when I tried.
Hopefully, an UN or ISO definition will be written down soon. For the time being it may be helpful if SAP tells us at least where the ABAP regex has differences compared with i.e. Regular Expressions in Single UNIX ® Specification, Version 2 (http://regexlib.com/DisplayPatterns.aspx)
Regards, Clemens
‎2008 Jul 25 11:10 AM
Hi,
I also played with regular expressions in ABAP and other tools. And every tool worked a little bit different. According to the SAP documentation is ABAP using the [Boost Regex Library|http://www.boost.org/].
Cause it is not very easy to implement REGEX machines I am not wondering why there are such differents in behaviour. But why ABAP behaves different when using FIND REGEX and the regex classes that is still a not answered question -> and .
Regards Rudi
‎2008 Aug 07 1:33 PM
Hi,
i think, i've read that ABAP uses the POSIX standard for RegEx. My experience is to use in windows tools like "textpad" to test my regular expressions.
reg, JR