Exemples de base (2)
o1 = new stzRegex("hello\d{3}")
? @@NL(o1.PartialMatchInfo("hello12"))[ [ "matchtype", "partial" ], [ "matched", "hello12" ], [ "section", [ 1, 7 ] ] ]
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 05_partial_match_detailed_match_information_for_ui_fe.ring(s'ouvre dans un nouvel onglet)
o1 = new stzRegex("^\d{2}:\d{2}:\d{2}$")
? @@NL( o1.PartialMatchInfo("12") ) + NL
? @@NL( o1.PartialMatchInfo("12:34") )[ [ "matchtype", "partial" ], [ "matched", "12" ], [ "section", [ 1, 2 ] ] ] [ [ "matchtype", "partial" ], [ "matched", "12:34" ], [ "section", [ 1, 5 ] ] ]
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 10_partial_match_time_format_validation.ring(s'ouvre dans un nouvel onglet)
Portée (4)
o1 = new stzRegex("^\d{3}-\d{3}-\d{4}$")
? @@NL( o1.PartialMatchInfo("123") ) + NL
? @@NL( o1.PartialMatchInfo("123-456") )[ [ "matchtype", "partial" ], [ "matched", "123" ], [ "section", [ 1, 3 ] ] ] [ [ "matchtype", "partial" ], [ "matched", "123-456" ], [ "section", [ 1, 7 ] ] ]
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 08_partial_match_phone_number_validation.ring(s'ouvre dans un nouvel onglet)
o1 = new stzRegex("^https?://[\w-]+(\.[\w-]+)*\.\w{2,}$")
? @@NL( o1.PartialMatchInfo("http") ) + NL
? @@NL( o1.PartialMatchInfo("https://example") )[ [ "matchtype", "partial" ], [ "matched", "http" ], [ "section", [ 1, 4 ] ] ] [ [ "matchtype", "partial" ], [ "matched", "https://example" ], [ "section", [ 1, 15 ] ] ]
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 11_partial_match_url_validation.ring(s'ouvre dans un nouvel onglet)
o1 = new stzRegex("^https?://[\w-]+(\.[\w-]+)*\.\w{2,}$")
? o1.PartialMatch("http")
? o1.FindPartialMatch("http")
? @@( o1.FindPartialMatchZZ("http") ) + NL
? @@NL( o1.PartialMatchInfo("http") )1 1 [ 1, 4 ] [ [ "matchtype", "partial" ], [ "matched", "http" ], [ "section", [ 1, 4 ] ] ]
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 25_findind_partial_matches.ring(s'ouvre dans un nouvel onglet)
o1 = new stzRegex(pat(:url))
cMyUrl = "https://example"
? o1.MatchPartial(cMyUrl)
? o1.FindPartialMatch(cMyUrl)
? @@( o1.FindPartialMatchZZ(cMyUrl) ) + NL
? @@NL( o1.PartialMatchInfo("https://example") )1 1 [ 1, 15 ] [ [ "matchtype", "partial" ], [ "matched", "https://example" ], [ "section", [ 1, 15 ] ] ]
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de 26_matchpartial.ring(s'ouvre dans un nouvel onglet)
Les extensions de cette méthode
Chaque extension, et si elle existe pour cette méthode ; une extension qui existe se compose avec les autres (FindSTCS).
Chaque exemple est un fichier de test de la bibliothèque, exécuté dans la bibliothèque pour cette page ; seuls ceux dont la sortie a tenu toutes les promesses écrites par leur fichier sont montrés. Les explications, les titres et le code sont ceux de la bibliothèque, en anglais.
Voir aussi
- La classe stzRegex
- La référence du domaine : Recherche de motifs
- Les autres méthodes de ces exemples : stzRegex.FindPartialMatch · stzRegex.IsPartialMatch

