Lodash - regular expressions
About
These functions provide a convenient way to use one-off regular expressions. If you are repeatedly using the same regular expression (e.g. in a loop), you should construct a cs.js.Regex
and use its functions instead.
API
.regexEscape()
.regexEscape(str : Text) : Text
Escapes any regex special characters (- ^ $ | \ . * + ? { } ( ) [ ]
) in str. Use this when you are dynamically building a regex pattern using unknown text.
.regexMatch()
.regexMatch(pattern : Text; str : Text { ; type : Text { ; start : Integer { ; throwOnBadPattern : Boolean }}) : Collection
A convenience function that returns the result of:
cs.js.Regex.new(pattern).match(str; type; start; throwOnBadPattern)
See Regex.match()
for more info.
.regexReplace()
.regexReplace(pattern : Text; str : Text; replacement : Text | Callable { ; count : Integer { ; throwOnBadPattern : Boolean }) : Text
A convenience function that returns the result of:
cs.js.Regex.new(pattern).replace(str; replacement; count; throwOnBadPattern)
See Regex.replace()
for more info.
.regexSplit()
.regexSplit(str : Text; separator : Text { ; limit : Integer { ; throwOnBadPattern : Boolean }) : Collection
A convenience function that returns the result of:
cs.js.Regex.new(separator).split(str; limit; throwOnBadPattern)
See Regex.split()
for more info.