10-14-2013 1:58 PM
Hi,
I would like to search for T1234567893 in a string with FIND ALL OCCURENCES OF REGEX....
T never change but the following 10 digits do.
I have tried this and it didnt work: T*[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
Thanks.
10-14-2013 2:06 PM
Hi Maria,
and what about CP :
Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used to create the operand2 pattern, where "*" represents any character string (including a blank string) and "+" represents any character. It is not case-sensitive. Trailing blanks in the left operand are respected. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "*" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1. You can select characters in operand2 for a direct comparison by adding the escape symbol"#" before the required characters. For characters flagged in this way in operand2, the operator is case-sensitive. Also, wildcard characters and the escape symbol are not subject to special handling and trailing blanks are relevant.
regards
Fred
10-14-2013 2:08 PM
Execute report RS_SIC_REGEX_CHECK, try with string "AAAT123456BB" and regex "T[0-9][0-9][0-9][0-9][0-9][0-9]" or "T[0-9]{6}", then read its source.
Regards,
Raymond
10-14-2013 2:11 PM
Hello Maria,
I would try to use this pattern:
T([0-9]{10})
Try it with the report DEMO_REGEX_TOY:
When using this expression you should also replace the numer-part with something else.
Kind regards,
Hendrik
10-14-2013 2:20 PM
I was not aware of this report RS_SIC_REGEX_CHECK screen is less attractive...
10-14-2013 2:34 PM
DEMO_REGEX_TOY is the best way to learn regular expressions in ABAP.
I would like to mention an alternative to get the match.
Expression (T\d{10}) would match T1234567893 and give same thing as submatch, whereas T(\d{10}) would match T1234567893, and return submatch as 1234567893.
Parenthesis ( ) are used to get enclosed part of pattern as submatch.
Curly brackets { } are used to specify the number of occurrences. Patterns [0-9][0-9][0-9], \d\d\d , \d{3} are same.