User Tools

Site Tools


abap:regex

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
abap:regex [2017/01/03 17:55] ginkoabap:regex [2021/07/23 18:23] (current) ginko
Line 12: Line 12:
   * 0 si début de la chaine   * 0 si début de la chaine
   * 1, n sinon   * 1, n sinon
 +
 +===== cl_abap_matcher =====
 +
 +**IMPORTANT** : Pour utiliser le matcher, il faut que la regex couvre tout le texte (genre commencer et finir par ''.*'' si les subgroups intéressants ne couvrent pas tout le texte) !
 +
 +[[https://codezentrale.de/tag/cl_abap_matcher/|Sauce]]
 +
 +<code abap>DATA(matcher) = cl_abap_matcher=>create( pattern     = '^/category/([0-9]{1,5})/item/([0-9]{1,2})$'
 +                                         text        = '/category/12345/item/12'
 +                                         ignore_case = abap_true ).
 + 
 +IF abap_true = matcher->match( ).
 +* erstes Match
 +  WRITE: / matcher->get_submatch( 1 ).
 +* zweites Match
 +  WRITE: / matcher->get_submatch( 2 ).
 +ENDIF.</code>
 +
abap/regex.txt · Last modified: 2021/07/23 18:23 by ginko