Regex module
This module provides functions to interface to libpcre (perl-compatible regular expressions) for constructing and matching with regular expressions.
Regular expression support is provided by the PCRE library package, which is open source software, written by Philip Hazel, and copyright by the University of Cambridge, England.
The pcrepattern or perlre manual pages explain the regular expression syntax in detail.
Data types
- Regex::Match - Match object.
- Regex::REFlags - Flags for regular expression compilation
- Regex::Regex - Compiled regular expression
- Regex::ReplaceFlags - Replacement options
Exceptions
- NoUTF8Support - UTF-8 support unavailable
- RegexCompilationFailed - The regular expression could not be compiled.
Functions
- Regex compile(String pattern,[REFlags] fl=createArray(1)) - Compile a regular expression
- Int count(Regex patt,String str) - Count occurrences of a regular expression in a string.
- [String] grep(String patt,[String] xs,Bool inverse=false) - Search for patterns.
- Match match(Regex x,String str) - Attempt to match a regular expression.
- Bool quickMatch(Regex re,String str) - Test a String with a compiled regular expression.
- Bool quickMatch(String patt,String str,[REFlags] fl=createArray(1)) - Test whether a string matches the pattern
- Void replace(Regex keyre,String new,var String str,[ReplaceFlags] fl=createArray(1)) - Replace a compiled pattern with a string.
- Void replace(String key,String new,var String str,[ReplaceFlags] fl=createArray(1),[REFlags] mfl=createArray(1)) - Replace a pattern with a string.
- String replaced(Regex keyre,String new,String str,[ReplaceFlags] fl=createArray(1)) - Replace a compiled pattern with a string.
- String replaced(String key,String new,String str,[ReplaceFlags] fl=createArray(1),[REFlags] mfl=createArray(1)) - Replace a compiled pattern with a string.
- [String] split(Regex pattre,String str,Int limit=0,Bool allowempty=false) - Split a string into substrings.
- [String] split(String patt,String str,Int limit=0,Bool allowempty=false) - Split a string into substrings.
- Void t_compile_fail() -
- Void t_compile_opts() -
- Void t_compile_utf8() -
- Void t_grep_all() -
- Void t_grep_empty1() -
- Void t_grep_empty2() -
- Void t_grep_invall() -
- Void t_grep_invsome() -
- Void t_grep_some() -
- Void t_match_matches() -
- Void t_quickMatch_cfalse() -
- Void t_quickMatch_ctrue1() -
- Void t_quickMatch_ctrue2() -
- Void t_quickMatch_false() -
- Void t_quickMatch_true1() -
- Void t_quickMatch_true2() -
- Void t_replace_all() -
- Void t_replace_allverlap() -
- Void t_replace_none() -
- Void t_replace_one() -
- Void t_replaced_all() -
- Void t_replaced_allverlap() -
- Void t_replaced_none() -
- Void t_replaced_one() -
- Void t_split_delimend1() -
- Void t_split_delimend2() -
- Void t_split_empty1() -
- Void t_split_empty2() -
- Void t_split_empty3() -
- Void t_split_limited1() -
- Void t_split_limited2() -
- Void t_split_limited3() -
- Void t_split_limited4() -
- Void t_split_limited5() -
- Void t_split_limitedend1() -
- Void t_split_limitedend2() -
- Void t_split_nodelim() -
- Void t_split_onlydelim1() -
- Void t_split_onlydelim2() -