Softanza
DémarrerEnglish
Softanza
Référence · stzRegex

PartialMatchInfo()

partial match

aussi écrite: MatchPartialInfo

Exemples de base (2)

Softanza
o1 = new stzRegex("hello\d{3}")
? @@NL(o1.PartialMatchInfo("hello12"))
Sortie
[
	[ "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)

Softanza
o1 = new stzRegex("^\d{2}:\d{2}:\d{2}$")
? @@NL( o1.PartialMatchInfo("12") ) + NL
? @@NL( o1.PartialMatchInfo("12:34") )
Sortie
[
	[ "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)

Softanza
o1 = new stzRegex("^\d{3}-\d{3}-\d{4}$")
? @@NL( o1.PartialMatchInfo("123") ) + NL
? @@NL( o1.PartialMatchInfo("123-456") )
Sortie
[
	[ "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)

Softanza
o1 = new stzRegex("^https?://[\w-]+(\.[\w-]+)*\.\w{2,}$")
? @@NL( o1.PartialMatchInfo("http") ) + NL
? @@NL( o1.PartialMatchInfo("https://example") )
Sortie
[
	[ "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)

Softanza
o1 = new stzRegex("^https?://[\w-]+(\.[\w-]+)*\.\w{2,}$")
? o1.PartialMatch("http")
? o1.FindPartialMatch("http")
? @@( o1.FindPartialMatchZZ("http") ) + NL
? @@NL( o1.PartialMatchInfo("http") )
Sortie
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)

Softanza
o1 = new stzRegex(pat(:url))
cMyUrl = "https://example"
? o1.MatchPartial(cMyUrl)
? o1.FindPartialMatch(cMyUrl)
? @@( o1.FindPartialMatchZZ(cMyUrl) ) + NL
? @@NL( o1.PartialMatchInfo("https://example") )
Sortie
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).

Extension
Existe
Ce qu'elle ajoute · Les noms
Q
non
fait ce que fait la méthode, puis rend l'objet, pour que l'appel puisse s'enchaîner
QQ
non
enchaîne sur le type d'objet suivant, plus précis (l'échelle des Q)
QQQ
non
enchaîne sur le type d'objet le plus précis (l'échelle des Q)
QRT
non
rend le résultat comme un objet du type demandé
CS
non
prend un indicateur de sensibilité à la casse
ST
non
prend la position de départ (StartingAt)
IB
non
prend des bornes incluses (IncludingBounds)
XT
non
la forme étendue : plus de paramètres que la méthode de base
XTT
non
encore une extension : une forme étendue de plus, après XT
Z
non
inclut la position dans ce qu'elle rend
ZZ
non
rend les positions comme des sections, [début, fin]
W
non
choisit selon une condition
WF
non
choisit selon une condition, avec les mots-clés expressifs (@NextItem, @PreviousItem...)
D
non
prend une direction, en avant ou en arrière (Directional)
F
non
prend une fonction (la condition ou la mise à jour est donnée comme une fonction) ; le document des formes emploie aussi F pour la forme future, qui diffère l'action
Many
non
travaille sur une collection d'éléments au lieu d'un seul (la forme plurielle)
Except
non
prend des exceptions, ce qu'il faut laisser de côté (la forme exceptionnelle)
U
non
rend le résultat sans doublon

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