Regular expressions: Difference between revisions

m (→‎{{header|Wren}}: Minor tidy)
Line 1,388:
 
=={{header|langur}}==
Langur uses semi-integreted regex. The following examples use re2 regex literals.
 
There are several functions that can be used with regexes, such as match(), replace(), split(), etc. They can also be matched in a givenswitch expression test.
 
To match a string, ...
Line 1,396:
 
Or...
{{works with|langur|0.10}}
<syntaxhighlight lang="langur">if val .x, .y = submatch(re/(abc+).+?(def)/, "somestring") { ... }</syntaxhighlight>
 
Prior to 0.10, multi-variable declaration/assignment would use parentheses around variable names and values.
<syntaxhighlight lang="langur">if val (.x, .y) = submatch(re/(abc+).+?(def)/, "somestring") { ... }</syntaxhighlight>
 
Or...
<syntaxhighlight lang="langur">givenswitch "somestring" {
case re/abc/: ...
...
Line 1,409 ⟶ 1,405:
 
Or...
<syntaxhighlight lang="langur">givenswitch re/abc/ {
case "somestring": ...
...
885

edits