/usr/share/doc/libghc-hxt-regex-xmlschema-doc/html/Text-Regex-XMLSchema-Generic-Matching.html is in libghc-hxt-regex-xmlschema-doc 9.2.0.2-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Regex.XMLSchema.Generic.Matching</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Text-Regex-XMLSchema-Generic-Matching.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-Regex-XMLSchema-Generic-Matching.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hxt-regex-xmlschema-9.2.0.2: A regular expression library for W3C XML Schema regular expressions</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Copyright (C) 2014- Uwe Schmidt</td></tr><tr><th>License</th><td>MIT</td></tr><tr><th>Maintainer</th><td>Uwe Schmidt <uwe@fh-wedel.de></td></tr><tr><th>Stability</th><td>stable</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Text.Regex.XMLSchema.Generic.Matching</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Convenient functions for W3C XML Schema Regular Expression Matcher.
For internals see <code><a href="Text-Regex-XMLSchema.html#v:Regex">Regex</a></code></p><p>Grammar can be found under <a href="http://www.w3.org/TR/xmlschema11-2/#regexs">http://www.w3.org/TR/xmlschema11-2/#regexs</a></p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:grep">grep</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> [s] -> [s]</li><li class="src short"><a href="#v:grepExt">grepExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> [s] -> [s]</li><li class="src short"><a href="#v:grepRE">grepRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> [s] -> [s]</li><li class="src short"><a href="#v:grepREwithLineNum">grepREwithLineNum</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> [s] -> [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a>, s)]</li><li class="src short"><a href="#v:match">match</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:matchExt">matchExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:matchSubex">matchSubex</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [(s, s)]</li><li class="src short"><a href="#v:sed">sed</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => (s -> s) -> s -> s -> s</li><li class="src short"><a href="#v:sedExt">sedExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => (s -> s) -> s -> s -> s</li><li class="src short"><a href="#v:split">split</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> (s, s)</li><li class="src short"><a href="#v:splitExt">splitExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> (s, s)</li><li class="src short"><a href="#v:splitSubex">splitSubex</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> ([(s, s)], s)</li><li class="src short"><a href="#v:tokenize">tokenize</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [s]</li><li class="src short"><a href="#v:tokenizeExt">tokenizeExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [s]</li><li class="src short"><a href="#v:tokenize-39-">tokenize'</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s s]</li><li class="src short"><a href="#v:tokenizeExt-39-">tokenizeExt'</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s s]</li><li class="src short"><a href="#v:tokenizeSubex">tokenizeSubex</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [(s, s)]</li><li class="src short"><a href="#v:matchRE">matchRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:matchSubexRE">matchSubexRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [(s, s)]</li><li class="src short"><a href="#v:sedRE">sedRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => (s -> s) -> <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> s</li><li class="src short"><a href="#v:splitRE">splitRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (s, s)</li><li class="src short"><a href="#v:splitSubexRE">splitSubexRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> ([(s, s)], s)</li><li class="src short"><a href="#v:tokenizeRE">tokenizeRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [s]</li><li class="src short"><a href="#v:tokenizeRE-39-">tokenizeRE'</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s s]</li><li class="src short"><a href="#v:tokenizeSubexRE">tokenizeSubexRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [(s, s)]</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:grep" class="def">grep</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> [s] -> [s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#grep" class="link">Source</a></p><div class="doc"><p>grep like filter for lists of strings</p><p>The regular expression may be prefixed with the usual context spec "^" for start of string,
and "\<" for start of word.
and suffixed with "$" for end of text and "\>" end of word.
Word chars are defined by the multi char escape sequence "\w"</p><p>Examples</p><pre>grep "a" ["_a_", "_a", "a_", "a", "_"] => ["_a_", "_a", "a_", "a"]
grep "^a" ["_a_", "_a", "a_", "a", "_"] => ["a_", "a"]
grep "a$" ["_a_", "_a", "a_", "a", "_"] => ["_a", "a"]
grep "^a$" ["_a_", "_a", "a_", "a", "_"] => ["a"]
grep "\\<a" ["x a b", " ax ", " xa ", "xab"] => ["x a b", " ax "]
grep "a\\>" ["x a b", " ax ", " xa ", "xab"] => ["x a b", " xa "]</pre></div></div><div class="top"><p class="src"><a name="v:grepExt" class="def">grepExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> [s] -> [s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#grepExt" class="link">Source</a></p><div class="doc"><p>grep with extended regular expressions</p></div></div><div class="top"><p class="src"><a name="v:grepRE" class="def">grepRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> [s] -> [s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#grepRE" class="link">Source</a></p><div class="doc"><p>grep with already prepared Regex (ususally with <code><a href="Text-Regex-XMLSchema-Generic-RegexParser.html#v:parseContextRegex">parseContextRegex</a></code>)</p></div></div><div class="top"><p class="src"><a name="v:grepREwithLineNum" class="def">grepREwithLineNum</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> [s] -> [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a>, s)] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#grepREwithLineNum" class="link">Source</a></p><div class="doc"><p>grep with Regex and line numbers</p></div></div><div class="top"><p class="src"><a name="v:match" class="def">match</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#match" class="link">Source</a></p><div class="doc"><p>convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:matchRE">matchRE</a></code></p><p>Examples:</p><pre>match "x*" "xxx" = True
match "x" "xxx" = False
match "[" "xxx" = False</pre></div></div><div class="top"><p class="src"><a name="v:matchExt" class="def">matchExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#matchExt" class="link">Source</a></p><div class="doc"><p>match with extended regular expressions</p></div></div><div class="top"><p class="src"><a name="v:matchSubex" class="def">matchSubex</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [(s, s)] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#matchSubex" class="link">Source</a></p><div class="doc"><p>convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:matchRE">matchRE</a></code></p><p>Examples:</p><pre>matchSubex "({1}x*)" "xxx" = [("1","xxx")]
matchSubex "({1}x*)" "y" = []
matchSubex "({w}[0-9]+)x({h}[0-9]+)" "800x600" = [("w","800"),("h","600")]
matchSubex "[" "xxx" = []</pre></div></div><div class="top"><p class="src"><a name="v:sed" class="def">sed</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => (s -> s) -> s -> s -> s <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#sed" class="link">Source</a></p><div class="doc"><p>convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:sedRE">sedRE</a></code></p><p>examples:</p><pre>sed (const "b") "a" "xaxax" = "xbxbx"
sed (\ x -> x ++ x) "a" "xax" = "xaax"
sed undefined "[" "xxx" = "xxx"</pre></div></div><div class="top"><p class="src"><a name="v:sedExt" class="def">sedExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => (s -> s) -> s -> s -> s <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#sedExt" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:split" class="def">split</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> (s, s) <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#split" class="link">Source</a></p><div class="doc"><p>convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:splitRE">splitRE</a></code></p><p>examples:</p><pre>split "a*b" "abc" = ("ab","c")
split "a*" "bc" = ("", "bc") -- "a*" matches ""
split "a+" "bc" = ("", "bc") -- "a+" does not match, no split
split "[" "abc" = ("", "abc") -- "[" syntax error, no split</pre></div></div><div class="top"><p class="src"><a name="v:splitExt" class="def">splitExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> (s, s) <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#splitExt" class="link">Source</a></p><div class="doc"><p>split with extended syntax</p></div></div><div class="top"><p class="src"><a name="v:splitSubex" class="def">splitSubex</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> ([(s, s)], s) <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#splitSubex" class="link">Source</a></p><div class="doc"><p>convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:splitSubex">splitSubex</a></code>, uses extended syntax</p><p>examples:</p><pre>splitSubex "({1}a*)b" "abc" = ([("1","a")],"c")
splitSubex "({2}a*)" "bc" = ([("2","")], "bc")
splitSubex "({1}a|b)+" "abc" = ([("1","a"),("1","b")],"c") -- subex 1 matches 2 times
splitSubex ".*({x}a*)" "aa" = ([("x",""),("x","a"),("x","aa")],"")
-- nondeterminism: 3 matches for a*
splitSubex "({1}do)|({2}[a-z]+)" "do you know"
= ([("1","do"),("2","do")]," you know")
-- nondeterminism: 2 matches for do
splitSubex "({1}do){|}({2}[a-z]+)" "do you know"
= ([("1","do")]," you know")
-- no nondeterminism with {|}: 1. match for do
splitSubex "({1}a+)" "bcd" = ([], "bcd") -- no match
splitSubex "[" "abc" = ([], "abc") -- syntax error</pre></div></div><div class="top"><p class="src"><a name="v:tokenize" class="def">tokenize</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenize" class="link">Source</a></p><div class="doc"><p>split a string into tokens (words) by giving a regular expression
which all tokens must match.</p><p>Convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:tokenizeRE">tokenizeRE</a></code></p><p>This can be used for simple tokenizers.
It is recommended to use regular expressions where the empty word does not match.
Else there will appear a lot of probably useless empty tokens in the output.
All none matching chars are discarded. If the given regex contains syntax errors,
<code>Nothing</code> is returned</p><p>examples:</p><pre>tokenize "a" "aabba" = ["a","a","a"]
tokenize "a*" "aaaba" = ["aaa","a"]
tokenize "a*" "bbb" = ["","",""]
tokenize "a+" "bbb" = []
tokenize "a*b" "" = []
tokenize "a*b" "abc" = ["ab"]
tokenize "a*b" "abaab ab" = ["ab","aab","ab"]
tokenize "[a-z]{2,}|[0-9]{2,}|[0-9]+[.][0-9]+" "ab123 456.7abc"
= ["ab","123","456.7","abc"]
tokenize "[a-z]*|[0-9]{2,}|[0-9]+[.][0-9]+" "cab123 456.7abc"
= ["cab","123","456.7","abc"]
tokenize "[^ \t\n\r]*" "abc def\t\n\rxyz"
= ["abc","def","xyz"]
tokenize ".*" "\nabc\n123\n\nxyz\n"
= ["","abc","123","","xyz"]
tokenize ".*" = lines
tokenize "[^ \t\n\r]*" = words</pre></div></div><div class="top"><p class="src"><a name="v:tokenizeExt" class="def">tokenizeExt</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenizeExt" class="link">Source</a></p><div class="doc"><p>tokenize with extended syntax</p></div></div><div class="top"><p class="src"><a name="v:tokenize-39-" class="def">tokenize'</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenize%27" class="link">Source</a></p><div class="doc"><p>convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:tokenizeRE-39-">tokenizeRE'</a></code></p><p>When the regular expression parses as Zero, <code>[Left input]</code> is returned, that means no tokens are found</p></div></div><div class="top"><p class="src"><a name="v:tokenizeExt-39-" class="def">tokenizeExt'</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenizeExt%27" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:tokenizeSubex" class="def">tokenizeSubex</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => s -> s -> [(s, s)] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenizeSubex" class="link">Source</a></p><div class="doc"><p>convenient function for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:tokenizeSubexRE">tokenizeSubexRE</a></code> a string</p><p>examples:</p><pre>tokenizeSubex "({name}[a-z]+)|({num}[0-9]{2,})|({real}[0-9]+[.][0-9]+)"
"cab123 456.7abc"
= [("name","cab")
,("num","123")
,("real","456.7")
,("name","abc")]
tokenizeSubex "({real}({n}[0-9]+)([.]({f}[0-9]+))?)"
"12.34" = [("real","12.34")
,("n","12")
,("f","34")]
tokenizeSubex "({real}({n}[0-9]+)([.]({f}[0-9]+))?)"
"12 34" = [("real","12"),("n","12")
,("real","34"),("n","34")]
tokenizeSubex "({real}({n}[0-9]+)(([.]({f}[0-9]+))|({f})))"
"12 34.56" = [("real","12"),("n","12"),("f","")
,("real","34.56"),("n","34"),("f","56")]</pre></div></div><div class="top"><p class="src"><a name="v:matchRE" class="def">matchRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#matchRE" class="link">Source</a></p><div class="doc"><p>match a string with a regular expression</p></div></div><div class="top"><p class="src"><a name="v:matchSubexRE" class="def">matchSubexRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [(s, s)] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#matchSubexRE" class="link">Source</a></p><div class="doc"><p>match a string with a regular expression
and extract subexpression matches</p></div></div><div class="top"><p class="src"><a name="v:sedRE" class="def">sedRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => (s -> s) -> <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> s <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#sedRE" class="link">Source</a></p><div class="doc"><p>sed like editing function</p><p>All matching tokens are edited by the 1. argument, the editing function,
all other chars remain as they are</p></div></div><div class="top"><p class="src"><a name="v:splitRE" class="def">splitRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (s, s) <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#splitRE" class="link">Source</a></p><div class="doc"><p>split a string by taking the longest prefix matching a regular expression</p><p><code>Nothing</code> is returned in case there is no matching prefix,
else the pair of prefix and rest is returned</p></div></div><div class="top"><p class="src"><a name="v:splitSubexRE" class="def">splitSubexRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> ([(s, s)], s) <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#splitSubexRE" class="link">Source</a></p><div class="doc"><p>split a string by removing the longest prefix matching a regular expression
and then return the list of subexpressions found in the matching part</p><p><code>Nothing</code> is returned in case of no matching prefix,
else the list of pairs of labels and submatches and the
rest is returned</p></div></div><div class="top"><p class="src"><a name="v:tokenizeRE" class="def">tokenizeRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenizeRE" class="link">Source</a></p><div class="doc"><p>The function, that does the real work for <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:tokenize">tokenize</a></code></p></div></div><div class="top"><p class="src"><a name="v:tokenizeRE-39-" class="def">tokenizeRE'</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> s s] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenizeRE%27" class="link">Source</a></p><div class="doc"><p>split a string into tokens and delimierter by giving a regular expression
which all tokens must match</p><p>This is a generalisation of the above <code><a href="Text-Regex-XMLSchema-Generic-Matching.html#v:tokenizeRE">tokenizeRE</a></code> functions.
The none matching char sequences are marked with <code>Left</code>, the matching ones are marked with <code>Right</code></p><p>If the regular expression contains syntax errors <code>Nothing</code> is returned</p><p>The following Law holds:</p><pre>concat . map (either id id) . tokenizeRE' re == id</pre></div></div><div class="top"><p class="src"><a name="v:tokenizeSubexRE" class="def">tokenizeSubexRE</a> :: <a href="Text-Regex-XMLSchema-Generic-StringLike.html#t:StringLike">StringLike</a> s => <a href="Text-Regex-XMLSchema-Generic-Regex.html#t:GenRegex">GenRegex</a> s -> s -> [(s, s)] <a href="src/Text-Regex-XMLSchema-Generic-Matching.html#tokenizeSubexRE" class="link">Source</a></p><div class="doc"><p>split a string into tokens (pair of labels and words) by giving a regular expression
containing labeled subexpressions.</p><p>This function should not be called with regular expressions
without any labeled subexpressions. This does not make sense, because the result list
will always be empty.</p><p>Result is the list of matching subexpressions
This can be used for simple tokenizers.
At least one char is consumed by parsing a token.
The pairs in the result list contain the matching substrings.
All none matching chars are discarded. If the given regex contains syntax errors,
<code>Nothing</code> is returned</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|