Regular expressions: Difference between revisions

 
Line 1,390:
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 inusing athe switchforward expressionoperator test(->).
 
To match a string, ...
<syntaxhighlight lang="langur">if matching("somestring" -> re/abc/, "somestring") { ... }</syntaxhighlight>
 
Or...
Line 1,400:
Or...
<syntaxhighlight lang="langur">switch "somestring" {
case -> re/abc/: ...
...
}</syntaxhighlight>
 
Or...
<syntaxhighlight lang="langur">switch -> re/abc/ {
case "somestring": ...
...
885

edits