REPORT zdemo16 MESSAGE-ID bupa_tax.
DATA: gv_matcher TYPE REF TO cl_abap_matcher,
gv_match TYPE c LENGTH 1.
DATA: gv_stringa TYPE string.
gv_stringa = 'AB012'.
TRY.
CALL METHOD cl_abap_matcher=>create
EXPORTING
pattern = '[A-Z0-9]{5}'
text = gv_stringa
RECEIVING
matcher = gv_matcher.
* CATCH CX_SY_REGEX .
* CATCH CX_SY_MATCHER .
ENDTRY.
gv_match = gv_matcher->match( ).
IF gv_match <> 'X'.
MESSAGE e305 RAISING invalid_taxnum.
ELSE.
WRITE gv_match.
ENDIF.
阅读(12759) | 评论(0) | 转发(0) |