2018 Feb 14 8:55 AM
Hi.
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?
2018 Feb 15 1:49 PM
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.
Michelle
2018 Feb 15 3:21 PM
Assuming you also want to exclude commented lines:
^[^\*](.+)werks = ‘11
or cast the net a bit wider with
^[^\*](.+)werks(.+)11
2018 Mar 04 2:17 PM
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".
Thanks
Ariel
2018 Mar 04 4:45 PM
I just tried it and you're partly right, the first one needs the equal sign escaped, but the second variant works for me.
^[^\*](.+)werks(.+)'
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:
^[^\*](.+)werks(.+)['|`|\|]
2018 Mar 04 3:38 PM