Skip to Content

ABAP regex help needed

Feb 14 at 08:55 AM


avatar image


I'm trying to find code in abap using abap_source_scan & regex.

I want to find if developer used to write company code hard coded in program (or plant or a set of others such as vkorg etc)

I've been trying to build a regex using the regex toy and succeded finding the company numbers:

11(\s|pm|qt|00|rt) gave me all the company code I'm searching: 11,11pm,11qt,1100 & 11rt. I wanted to get only lines that include the word "werks" . tried

11(\s|pm|qt|00|rt)(?=werks) didn't work. Any idea How can it be done?

10 |10000 characters needed characters left characters exceeded

Awful answer so I put it in the comments.

Create a program to look at their transports and go through the programs based on anything they touched. Search the source code of everything they touched for your plant numbers. Then display it as an ALV with a double click.

Sorry - I can't think of anything else. I'm hoping someone else has a great answer for you.


* Please Login or Register to Answer, Follow or Comment.

2 Answers

Mike Pokraka Feb 15 at 03:21 PM

Assuming you also want to exclude commented lines:

^[^\*](.+)werks = ‘11

or cast the net a bit wider with

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks Mike Pokraka , tried it with DEMO_REGEX_TOY but I got nothing, any idea why?

I tchanged the text and added "11" and "werks" in thw "Text box".




I just tried it and you're partly right, the first one needs the equal sign escaped, but the second variant works for me.


Will find

   if werks <> '1234'.

but ignore

*    werks = '1234'.

And of you want to specifically restrict it to equality, then my first variant needs the equal sign escaped:

^[^\*](.+)werks \= ‘11

To break it down:

^ : Beginning of line

[^\*] : Not a *

(.+) : one or more characters

werks : werks

(.+) : one or more characters

' : '

Writing this I suppose a better search would be to include different string delimiters:

Horst Keller
Mar 04 at 03:38 PM
10 |10000 characters needed characters left characters exceeded