Regular expressions: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
Langurmonkey (talk | contribs) |
||
Line 1,083: | Line 1,083: | ||
=={{header|Langur}}== |
=={{header|Langur}}== |
||
Langur uses semi-integreted regex. |
Langur uses semi-integreted regex. There are several functions that can be used with regexes, such as match(), replace(), split(), etc. |
||
Interpolated strings or regex literals require a $ sign. |
|||
<lang Langur>$"\.x;" # interpolated string |
|||
$re/\.x;/ # interpolated regex</lang> |
|||
Valid quote mark pairs include the following. |
|||
<lang Langur>// '' "" {} [] () <></lang> |
|||
There are several functions that can be used with regexes, such as match(), replace(), split(), etc. |
|||
Progressive matching (a.k.a. "global") is done with split() and replace() and the functions that use the plural form, such as matches(), indices(), etc. These will return an array or array of arrays. Progressive matching can be limited by passing a maximum. |
|||
Regex functions that return an array will return an empty array for no match. The matching() function returns a Boolean. The match() function returns a string (or null for no match). |
|||
To match a string, ... |
To match a string, ... |