ABAP Evaluating Regular Expressions with a Predicate Function


Example

The predicate function matches can be used to evaluate strings on the fly without use of any object declarations.

IF matches( val = 'Not a hex string'
            regex = '[0-9a-f]*' ).
  cl_demo_output=>display( 'This will not display' ).
ELSEIF matches( val = '6c6f7665'
                regex = '[0-9a-f]*' ).
  cl_demo_output=>display( 'This will display' ).
ENDIF.