ReplaceString (Regex property): Difference between revisions
Jump to navigation
Jump to search
(Automatically generated page update) |
No edit summary |
||
Line 1: | Line 1: | ||
{{Template:Regex: | {{Template:Regex:RegexString subtitle}} | ||
This | This method returns the replacement string value specified in the [[New (Regex constructor)|Regex constructor]] call. | ||
==Syntax== | ==Syntax== | ||
{{Template:Regex:ReplaceString syntax}} | {{Template:Regex:ReplaceString syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%string</th><td>string</td></tr> | <tr><th>%string</th><td>The replacement string value specified in the Regex constructor call.</td></tr> | ||
<tr><th>regex</th> | <tr><th>regex</th> | ||
<td><var>Regex</var> object</td></tr> | <td>The <var>Regex</var> object.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | |||
<li>If the regular expresion specified in the constructor call was Unicode, this method causes request cancellation. To test if a <var>Regex</var> object was created with a Unicode regular expression check the [[IsUnicode (Regex property)|IsUnicode property]].</li> | |||
<li>If no replacement string value was specified in the constructor call, a zero-length string is returned.</li> | |||
</ul> | |||
==Examples== | ==Examples== | ||
The following example: | |||
<p class="code">b | |||
%regex is object regex | |||
%regex = new("([a-z]{3,})(\d{3,})", replace="$2$1") | |||
print %regex:replaceString | |||
end | |||
</p> | |||
displays: | |||
<p class="code">$2$1 | |||
</p> | |||
==See also== | ==See also== | ||
{{Template:Regex:ReplaceString footer}} | {{Template:Regex:ReplaceString footer}} | ||
[[Category:Regular expression processing]] |
Latest revision as of 18:39, 23 March 2022
String regular expression (Regex class)
This method returns the replacement string value specified in the Regex constructor call.
Syntax
%string = regex:ReplaceString
Syntax terms
%string | The replacement string value specified in the Regex constructor call. |
---|---|
regex | The Regex object. |
Usage notes
- If the regular expresion specified in the constructor call was Unicode, this method causes request cancellation. To test if a Regex object was created with a Unicode regular expression check the IsUnicode property.
- If no replacement string value was specified in the constructor call, a zero-length string is returned.
Examples
The following example:
b %regex is object regex %regex = new("([a-z]{3,})(\d{3,})", replace="$2$1") print %regex:replaceString end
displays:
$2$1