特殊字符‘,.()’以外的不合格
TYPES: BEGIN OF ty_c,
zm_zd TYPE char30,
END OF ty_c.
DATA: lt_ty TYPE TABLE OF ty_c.
DATA: ls_ty LIKE LINE OF lt_ty.
DATA matcher TYPE REF TO cl_abap_matcher.
DATA: lv_a TYPE c LENGTH 10 VALUE '@你好,.()看',
lv_b TYPE c,
lv_c TYPE c,
lv_d TYPE c.
DATA: lv_num TYPE i,
lv_ks TYPE i,
lv_bl TYPE i.
lv_ks = 1.
lv_bl = 0.
lv_num = strlen( lv_a ).
WHILE lv_num >= lv_ks .
ls_ty-zm_zd = lv_a+lv_bl(1).
APPEND ls_ty TO lt_ty.
CLEAR ls_ty.
lv_ks = lv_ks + 1.
lv_bl = lv_bl + 1.
ENDWHILE.
LOOP AT lt_ty INTO ls_ty.
WRITE:/ ls_ty-zm_zd.
ENDLOOP.
LOOP AT lt_ty INTO ls_ty.
matcher = cl_abap_matcher=>create( pattern = '\w'
ignore_case = 'X'
text = ls_ty-zm_zd ).
IF matcher->match( ) IS INITIAL.
IF ',.()' CA ls_ty-zm_zd .
MESSAGE 'Format OK' TYPE 'I'.
ELSE.
lv_b = 'X'.
MESSAGE 'Wrong Format' TYPE 'I'.
EXIT.
ENDIF.
ELSE.
MESSAGE 'Format OK' TYPE 'I'.
ENDIF.
ENDLOOP.
IF lv_b IS NOT INITIAL.
ENDIF.