Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Need help on a REGEX expression

Former Member
0 Likes
1,126

Hi Gurus.

I need to make a REGEX to find such a pattern:

<L or G>TY_<S or T_*.

How can I make a REGEX for it? If it is not clear, what i mean is first letter can be L or G, after that will be TY_, then followed by a single character S or T, followed by an underscore (_) and then anything after that is okay.

All are case insensitive.

Your help is greatly appreciated. Thanks in adv.

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
988

You can try it

link:[REGEX TOY- TESTING REGULAR EXPRESSIONS IN ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1f9cd701-0b01-0010-87b8-f86f9b7b823f]

6 REPLIES 6
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
989

You can try it

link:[REGEX TOY- TESTING REGULAR EXPRESSIONS IN ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1f9cd701-0b01-0010-87b8-f86f9b7b823f]

Read only

0 Likes
988

Hi Aishi Sharma,

It is little bit complex to frame a single Regular expression, However you can use the following:

You can use the below 4 Regular expressions one after the other.

1. LTY_S_

2. GTY_S_

3. LTY_T_

4. GTY_T_

You know how to use it once,the similar way use the 4 expressions one after the other and store the result in an internal table.

So you will get the solution.

Hope this helps you.

Regards,

Rama.P

Read only

former_member156446
Active Contributor
0 Likes
988

To test the regex for your text.. you can use the prog DEMO_REGEX_TOY and use green tick to execute the matches,

[Regular Expressions for Information Processing|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/866072ca-0b01-0010-54b1-9c02a45ba8aa?quicklink=index&overridelayout=true]

Read only

Former Member
0 Likes
988

Hi,

I am not sure about it, because I have not try it, but it could be like this:

[LG]TY_[ST][[:alnum:]]*

Check [Syntax of Regular Expressions|http://help.sap.com/abapdocu_70/en/ABENREGEX_SYNTAX.htm] for further info.

Regards,

Adrian

Read only

0 Likes
988

Thanks, but i know about these documents.

But still cannot work out this simple REGEX>

What you gave did not work for me

To elaborate, I am using it to set up the Code Inspector Naming conventions, and gave this expression in the Types field.

Does not work

Any other suggestions?

Thanks in adv.

Read only

0 Likes
988

Hi,

so it is much easier than You think:-) "Types field" is a select-option with multiple selection allowed, so You can put here following 4 lines:

GTY_S*

LTY_S*

GTY_T*

LTY_T*

That's all.

Adrian