2012 Feb 14 8:02 AM
Does 4.7 system support REGEX ? If not , then what is the alternate that we need to use in the ABAP code ?
2012 Feb 14 8:33 AM
ABAP supports regular expressions as of Release 7.00.
One more thing is there , if you are able to install the patches from SAP for lower versions you can use it ( BASIS team will be knowing the correct patch).
Regards,
Ben
Does 4.7 system support REGEX ? If not , then what is the alternate that we need to use in the ABAP code ?
2012 Feb 14 8:21 AM
Regex is supported from release 7.0 only.
http://help.sap.com/abapdocu_70/en/ABENREGULAR_EXPRESSIONS.htm
2012 Feb 14 8:57 AM
Is there any alternate of REGEX that can be used in 4.7 system ?
2012 Feb 14 9:29 AM
Hi Nikhil,
It will depend on your requirement.Anyway there is no exact function that do the 'regex' in ABAP.
<< Moderator message - Cut and paste response from http://sample-code-abap.blogspot.com/2010/02/regular-expression-in-sap-abap.html removed and points unassigned. Plagiarism is not allowed in SCN >>
These are some of the common use.
Please go through these SCN Blogs
[http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/18115]
[http://sapignite.com/regex-in-abap/].
[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/866072ca-0b01-0010-54b1-9c02a45ba8aa?QuickLink=index&overridelayout=true]
So make sure what is your play with REGEX and these things are achieved by normal ABAP coding also.
Matt,
Thanks for your valuable info.
Edited by: Rob Burbank on Feb 14, 2012 9:42 AM
2012 Feb 14 9:41 PM
Hi Nikhil,
it really depends on your requirement. Before regex was introduced, SAP provided powerful spaghetti code functions for relatively simple purposes like the check of validity of an email address which can be done better using regex.
In simple cases, especially where performance is required, you are by far better off using the existing CS CP NP operators combined with (length)+offset.
I used regex intensively once in an ALV spreadsheet with tens of thousands of cells. Then I did a performance analysis, then I replaced all regex with old-fashioned code - got a performance boost.
Regards,
Clemens
2012 Feb 15 5:16 AM
Clemens - I'm not sure you're right about regex and email address validation - it's one of the notorious problems for regex. e.g. http://stackoverflow.com/questions/201323/how-to-use-a-regular-expression-to-validate-an-email-addre...
2012 Feb 15 9:30 PM
Hi Matt,
yes, you are right, the example was not chosen properly.
My statement is only that regex is powerful put slow and can be replaced by 'conventional' code..
Regards,
Clemens
2012 Feb 14 8:33 AM
ABAP supports regular expressions as of Release 7.00.
One more thing is there , if you are able to install the patches from SAP for lower versions you can use it ( BASIS team will be knowing the correct patch).
Regards,
Ben
2012 Feb 14 9:12 AM
There is a workaround involving invoking JavaScript from ABAP. The details are [here|http://www.web-dreamer.de/blog/2008/02/abap-using-regex-regular-expressions-in-a-pre-netweaver-release.html].
I have used this solution and confirm that it work.
2012 Feb 14 3:05 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |