Regular expression pattern matching
===================================================
main definitions:
rxmatch single match
rxmatches all matches
rxcomp compile pattern
rxfree free pattern handles
rxhandles list pattern handles
rxinfo info on pattern handles
regex utilities:
rxeq -:
rxin e.
rxindex i.
rxE E.
rxfirst {.@{ (first match)
rxall { (all matches)
rxrplc search and replace
rxapply apply verb to pattern
rxerror last regex error message
other utilities:
rxcut cut string into nomatch/match list
rxfrom matches from string
rxmerge replace matches in string
===================================================
Form:
here: pat = pattern, or pattern handle
phnd = pattern handle
patndx = pattern;index or phnd,index
str = character string
bstr = boxed list of str
mat = result of regex search
nsub = #subexpressions in pattern
mat=. pat rxmatch str
mat=. pat rxmatches str
phnd=. rxcomp pat
empty=. rxfree phnd
phnds=. rxhandles ''
'nsub pat'=. rxinfo phnd
boolean=. pat rxeq str
index=. pat rxindex str
mask=. pat rxE str
bstr=. pat rxfirst str
bstr=. pat rxall str
str=. (patndx;new) rxrplc str
str=. patndx (verb rxapply) str
errormsg=. rxerror ''
bstr mat rxcut str
bstr=. mat rxfrom str
str=. new (mat rxmerge) str
Defined items
Name | Class | Description |
---|
rxmatch | Verb | single match |
rxmatches | Verb | all matches |
rxcomp | Verb | compile pattern |
rxfree | Verb | free pattern handles |
rxhandles | Verb | list pattern handles |
rxinfo | Verb | info on pattern handles |
rxeq | Verb | regex equivalent of -: |
rxin | Verb | regex equivalent of e. |
rxindex | Verb | regex equivalent of i. |
rxE | Verb | regex equivalent of E. |
rxfirst | Verb | regex equivalent of {.@{ (first match) |
rxall | Verb | regex equivalent of { (all matches) |
rxrplc | Verb | search and replace |
rxapply | Verb | apply verb to pattern |
rxerror | Verb | last regex error message |
rxcut | Verb | cut string into nomatch/match list |
rxfrom | Verb | matches from string |
rxmerge | Verb | replace matches in string |