Copy (Regex function): Difference between revisions
(Automatically generated page update) |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Regex:Copy subtitle}} | {{Template:Regex:Copy subtitle}} | ||
This | This method makes a copy of the <var>Regex</var> object. | ||
This method is identical to [[DeepCopy (Regex function)|DeepCopy]]. | |||
==Syntax== | ==Syntax== | ||
{{Template:Regex:Copy syntax}} | {{Template:Regex:Copy syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%outRegex</th><td><var>Regex</var> object</td></tr> | <tr><th>%outRegex</th><td>A new <var>Regex</var> object</td></tr> | ||
<tr><th>regex</th> | <tr><th>regex</th> | ||
<td>Regex object, which may be <var>Null</var></td></tr> | <td>Regex object, which may be <var>Null</var></td></tr> | ||
</table> | </table> | ||
==Examples== | ==Examples== | ||
The following make a copy of a <var>Regex</var> object and then uses it to do a match: | |||
<p class="code">%regex is object regex | |||
%regex2 is object regex | |||
%str is longstring | |||
... | |||
%regex2 = %regex:copy | |||
if %regex2:match(%str) then | |||
... | |||
end if | |||
</p> | |||
==See also== | ==See also== | ||
{{Template:Regex:Copy footer}} | {{Template:Regex:Copy footer}} | ||
{{Template:Regex:IsUnicode subtitle}} | |||
This method indicates whether or not the regular expression used to create the <var>Regex</var> object was specified in Unicode. | |||
==Syntax== | |||
{{Template:Regex:IsUnicode syntax}} | |||
===Syntax terms=== | |||
<table class="syntaxTable"> | |||
<tr><th>%boolean</th><td><var>Boolean</var> value that indicates whether (<var>true</var>) or not (<var>false</var>) the regular expression used to constuct the <var>Regex</var> object was Unicode.</td></tr> | |||
<tr><th>regex</th> | |||
<td>The <var>Regex</var> object</td></tr> | |||
</table> | |||
==Examples== | |||
The following example: | |||
<p class="code">b | |||
%regex is object regex | |||
%regex = new("(((Tomorrow|Today) is)|(Yesterday was)) Pie Day", options="i") | |||
print %regex:isUnicode | |||
%regex = new("((Tomorrow|Today) is)|(Yesterday was) π Day":u, options="i") | |||
print %regex:isUnicode | |||
end | |||
</p> | |||
displays: | |||
<p class="code">False | |||
True | |||
</p> | |||
==See also== | |||
{{Template:Regex:IsUnicode footer}} | |||
[[Category:Regular expression processing]] |
Latest revision as of 02:16, 14 March 2022
Return a copy of a Regex object (Regex class)
This method makes a copy of the Regex object.
This method is identical to DeepCopy.
Syntax
%outRegex = regex:Copy
Syntax terms
%outRegex | A new Regex object |
---|---|
regex | Regex object, which may be Null |
Examples
The following make a copy of a Regex object and then uses it to do a match:
%regex is object regex %regex2 is object regex %str is longstring ... %regex2 = %regex:copy if %regex2:match(%str) then ... end if
See also
Is this a Unicode regular expression (Regex class)
This method indicates whether or not the regular expression used to create the Regex object was specified in Unicode.
Syntax
%boolean = regex:IsUnicode
Syntax terms
%boolean | Boolean value that indicates whether (true) or not (false) the regular expression used to constuct the Regex object was Unicode. |
---|---|
regex | The Regex object |
Examples
The following example:
b %regex is object regex %regex = new("(((Tomorrow|Today) is)|(Yesterday was)) Pie Day", options="i") print %regex:isUnicode %regex = new("((Tomorrow|Today) is)|(Yesterday was) π Day":u, options="i") print %regex:isUnicode end
displays:
False True