Jump to content

Regular expressions: Difference between revisions

Line 1,083:
 
=={{header|Langur}}==
Langur uses semi-integreted regex. AnThere re2are literalseveral withoutfunctions interpretingthat langurcan escapebe codes uses RE// andused with langurregexes, escapesuch codesas interpretedmatch(), uses re//. Langur escape codesreplace(), when applicablesplit(), are interpreted before a string is sent to the regex compileretc.
 
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, ...
890

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.