Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Regex with negation not working

Hi,


I have this simple ABAP report that it supposed to print out on the screen a message if a string input contains a non-numeric symbol. I use regex '[^0-9]' in order to do that. However, the program never ends up setting sy-subrc to 0, so it never finds a non-numeric symbol in string. Is there something wrong with my regex?

REPORT  Z_SAMPLE.

data: input type c length 4 value '123a'.

find first occurrence of '[^0-9]' in input.

if sy-subrc = 0.

   Write: 'Found non-numeric character in ', input, /.

endif.

Thanks in advance

Tags:
replied

FIND FIRST OCCURRENCE OF REGEX ..

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question