regex-examples 0.11.0.0 → 0.11.1.0
raw patch · 30 files changed
+1178/−677 lines, 30 filesdep +filepathdep ~regexdep ~regex-with-pcre
Dependencies added: filepath
Dependency ranges changed: regex, regex-with-pcre
Files
- changelog +3/−0
- data/pcre-macros.txt +143/−0
- data/pcre-nginx-log-processor.txt +159/−0
- data/tdfa-macros.txt +150/−0
- docs/pcre-macros.txt +0/−143
- docs/pcre-nginx-log-processor.txt +0/−159
- docs/tdfa-macros.txt +0/−150
- examples/re-nginx-log-processor.lhs +22/−14
- examples/re-prep.lhs +1/−1
- examples/re-tests.lhs +12/−1
- examples/re-tutorial.lhs +6/−6
- lib/cabal-masters/executables-incl.cabal +2/−2
- lib/cabal-masters/library-incl.cabal +11/−11
- lib/cabal-masters/mega-regex.cabal +5/−4
- lib/cabal-masters/regex-examples.cabal +1/−1
- lib/cabal-masters/regex.cabal +10/−11
- lib/cabal-masters/test-extra-source-files-incl.cabal +3/−3
- lib/mega-regex.cabal +40/−35
- lib/version.txt +1/−1
- regex-examples.cabal +29/−25
- src/Text/RE/PCRE/ByteString.hs +58/−11
- src/Text/RE/PCRE/ByteString/Lazy.hs +58/−11
- src/Text/RE/PCRE/Sequence.hs +58/−11
- src/Text/RE/PCRE/String.hs +58/−11
- src/Text/RE/TDFA/ByteString.hs +58/−11
- src/Text/RE/TDFA/ByteString/Lazy.hs +58/−11
- src/Text/RE/TDFA/Sequence.hs +58/−11
- src/Text/RE/TDFA/String.hs +58/−11
- src/Text/RE/TDFA/Text.hs +58/−11
- src/Text/RE/TDFA/Text/Lazy.hs +58/−11
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +0.11.1.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-30+ * Cannot hide Text.RE.ZeInternals.SearchReaplace modules (#101)+ 0.11.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2017-03-29 * Simplify API (#97) * Rename Location to RELocation (#98)
+ data/pcre-macros.txt view
@@ -0,0 +1,143 @@+|name |caps|regex=regex=regex=regex=regex |examples |anti-examples |fails|parser |comment +|----------------|----|------------------------------------------|------------------------------------------|-----------------------------------------|-----|-----------------|------------------------------------------+|%address.ipv4 |0 |[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0\|0.0.0.0 | | |parseSeverity |an a.b.c.d IPv4 address +| | |\-9]{1,3} |123.45.6.78 |foo | | | +| | | |9.9.9.9 |1234.0.0.0 | | | +| | | |255.255.255.255 |1.2.3 | | | +| | | | |1.2.3. | | | +| | | | |1.2..4 | | | +| | | | |www.example.com | | | +| | | | |2001:0db8:85a3:0000:0000:8a2e:0370:7334 | | | +|%date |0 |[0-9]{4}-[0-9]{2}-[0-9]{2} |2016-12-31 | | |parseDate |a YYYY-MM-DD format date +| | | |0001-01-01 |2016/01/31 | | | +| | | |1000-01-01 |2016-1-31 | | | +| | | | |2016-01-1 | | | +| | | | |2016-001-01 | | | +|%date.slashes |0 |[0-9]{4}/[0-9]{2}/[0-9]{2} |2016/12/31 | | |parseSlashesDate |a YYYY/MM/DD format date +| | | |0001/01/01 |2016-01-31 | | | +| | | |1000/01/01 |2016/1/31 | | | +| | | | |2016/01/1 | | | +| | | | |2016/001/01 | | | +|%datetime |0 |@{%date}[ T]@{%time}(?:@{%timezone}| UTC)\|2016-12-31 23:37:22.525343 UTC | | |parseDateTime |ISO-8601 format date and time + simple va\+| | |\? |2016-12-31 23:37:22.525343 |2016-12-31 23:37:22.525343 EST | | |\riants +| | | |2016-12-31 23:37:22 | | | | +| | | |2016-12-31T23:37:22+0100 | | | | +| | | |2016-12-31T23:37:22-01:00 | | | | +| | | |2016-12-31T23:37:22-23:59 | | | | +| | | |2016-12-31T23:37:22Z | | | | +|%datetime.8601 |0 |@{%date}T@{%time}@{%timezone} |2016-12-31T23:37:22.343Z | | |parseDateTime8601|YYYY-MM-DDTHH:MM:SS[.Q*](Z|[+-]HHMM) form\+| | | |2016-12-31T23:37:22-0100 |2016-12-31 23:37:22.525343 EST | | |\at date and time +| | | |2016-12-31T23:37:22+23:59 | | | | +|%datetime.clf |0 |[0-9]{2}/@{%shortmonth}/[0-9]{4}:[0-9]{2}\|10/Oct/2000:13:55:36 -0700 | | |parseDateTimeCLF |Common Log Format date+time: %d/%b/%Y:%H:\+| | |\:[0-9]{2}:[0-9]{2} [+-][0-9]{2}:?[0-9]{2\|10/Oct/2000:13:55:36 +07:00 |2016-12-31T23:37+0100 | | |\%M:%S %z +| | |\} | |10/Oct/2000:13:55:36-0700 | | | +| | | | |10/OCT/2000:13:55:36 -0700 | | | +| | | | |10/Oct/2000:13:55 -0700 | | | +| | | | |10/Oct/2000:13:55Z | | | +|%email.simple |0 |[a-zA-Z0-9%_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0\|user-name%foo.bar.com@an-example.com | | |- |an email address +| | |\-9.-]+ | |not-an-email-address | | | +| | | | |@not-an-email-address | | | +|%frac |0 |-?[0-9]+(?:\.[0-9]+)? |0 | | |parseInteger |a decimal integer +| | | |1234567890 |0A | | | +| | | |00 |+0 | | | +| | | |01 |0. | | | +| | | |-1 |.0 | | | +| | | |-0 |. | | | +| | | |0.1234567890 |- | | | +| | | |-1.0 |-. | | | +| | | | |-1. | | | +| | | | |-.1 | | | +|%hex |0 |[0-9a-fA-F]+ |0 | | |parseHex |a string of one or more hexadecimal digit\+| | | |12345678 |0x10 | | |\s +| | | |0abcdef |0z | | | +| | | |0ABCDEF |-1a | | | +| | | |00 | | | | +| | | |010 | | | | +|%id |0 |_*[a-zA-Z][a-zA-Z0-9_]* |a | | |- |a standard C-style alphanumeric identifie\+| | | |A |1 | | |\r (with _s) +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |a' | | | +|%id' |0 |_*[a-zA-Z][a-zA-Z0-9_']* |a | | |- |a standard Haskell-style alphanumeric ide\+| | | |A |1 | | |\ntifier (with '_'s and '''s) +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |' | | | +| | | |a' |'a | | | +| | | |_a' |_' | | | +| | | |a'b |_1' | | | +|%id- |0 |_*[a-zA-Z][a-zA-Z0-9_'-]* |a | | |- |an identifier with -s +| | | |A |1 | | | +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |' | | | +| | | |a' |'a | | | +| | | |_a' |_' | | | +| | | |a'b |_1' | | | +| | | |a- | | | | +| | | |a1-B2 | | | | +| | | |a1-B2- | | | | +|%int |0 |-?[0-9]+ |0 | | |parseInteger |a decimal integer +| | | |1234567890 |0A | | | +| | | |00 |+0 | | | +| | | |01 | | | | +| | | |-1 | | | | +| | | |-0 | | | | +|%nat |0 |[0-9]+ |0 | | |parseInteger |a string of one or more decimal digits +| | | |1234567890 |0A | | | +| | | |00 |-1 | | | +| | | |01 | | | | +|%shortmonth |0 |(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oc\|Jan | | |parseShortMonth |three letter month name: Jan-Dec +| | |\t|Nov|Dec) |Feb |jan | | | +| | | |Dec |DEC | | | +| | | | |January | | | +| | | | |01 | | | +| | | | |1 | | | +|%string.simple |0 |"[^"[:cntrl:]]*" |"" | | |parseSimpleString|a decimal integer +| | | |"foo" |" | | | +| | | |"\" |"\"" | | | +| | | |"" |"\"\"" | | | +| | | | |"\"\\\"" | | | +| | | | |"\"foo\"" | | | +| | | | |"aa | | | +|%syslog.severity|0 |(?:emerg|panic|alert|crit|warning|warn|no\|emerg | | |parseSeverity |syslog severity keyword (debug-emerg) +| | |\tice|info|debug|err(?:or)?) |panic |Emergency | | | +| | | |alert |ALERT | | | +| | | |crit | | | | +| | | |err | | | | +| | | |error | | | | +| | | |warn | | | | +| | | |warning | | | | +| | | |notice | | | | +| | | |info | | | | +| | | |debug | | | | +|%time |0 |[0-9]{2}:[0-9]{2}:[0-9]{2}(?:[.][0-9]+)? |00:00:00 | | |parseTimeOfDay |a HH:MM:SS[.Q+] +| | | |23:59:59 |235959 | | | +| | | |00:00:00.1234567890 |10:20 | | | +| | | | |A00:00:00 | | | +| | | | |00:00:00A | | | +| | | | |23:59:59. | | | +|%timezone |0 |(?:Z|[+-][0-9]{2}:?[0-9]{2}) |Z | | |parseTimeZone |an IOS-8601 TZ specification +| | | |+00:00 |00 | | | +| | | |+0000 |A00:00 | | | +| | | |+0200 |UTC | | | +| | | |-0100 |EST | | | +| | | | | EST | | | +|%url |1 |([hH][tT][tT][pP][sS]?|[fF][tT][pP])://[^\|https://mathiasbynens.be/demo/url-regex | | |- |a URL +| | |\[:space:]/$.?#].[^[:space:]]* |http://foo.com/blah_blah |http:// | | | +| | | |http://foo.com/blah_blah/ |http://. | | | +| | | |http://foo.com/blah_blah_(wikipedia) |http://.. | | | +| | | |http://foo.com/blah_blah_(wikipedia)_(aga\|http://../ | | | +| | | |\in) |http://? | | | +| | | |http://www.example.com/wpstyle/?p=364 |http://?? | | | +| | | |HTTPS://foo.bar/?q=Test%20URL-encoded%20s\|http://foo.bar?q=Spaces should be encoded| | | +| | | |\tuff |// | | | +| | | |HTTP://223.255.255.254 |http://##/ | | | +| | | |ftp://223.255.255.254 |http://## | | | +| | | |FTP://223.255.255.254 |http://##/ | | |
+ data/pcre-nginx-log-processor.txt view
@@ -0,0 +1,159 @@+|name |caps|regex=regex=regex=regex=regex |examples |anti-examples |fails|parser |comment +|----------------|----|------------------------------------------|------------------------------------------|-----------------------------------------|-----|-----------------|------------------------------------------+|%address.ipv4 |0 |[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0\|0.0.0.0 | | |parseSeverity |an a.b.c.d IPv4 address +| | |\-9]{1,3} |123.45.6.78 |foo | | | +| | | |9.9.9.9 |1234.0.0.0 | | | +| | | |255.255.255.255 |1.2.3 | | | +| | | | |1.2.3. | | | +| | | | |1.2..4 | | | +| | | | |www.example.com | | | +| | | | |2001:0db8:85a3:0000:0000:8a2e:0370:7334 | | | +|%date |0 |[0-9]{4}-[0-9]{2}-[0-9]{2} |2016-12-31 | | |parseDate |a YYYY-MM-DD format date +| | | |0001-01-01 |2016/01/31 | | | +| | | |1000-01-01 |2016-1-31 | | | +| | | | |2016-01-1 | | | +| | | | |2016-001-01 | | | +|%date.slashes |0 |[0-9]{4}/[0-9]{2}/[0-9]{2} |2016/12/31 | | |parseSlashesDate |a YYYY/MM/DD format date +| | | |0001/01/01 |2016-01-31 | | | +| | | |1000/01/01 |2016/1/31 | | | +| | | | |2016/01/1 | | | +| | | | |2016/001/01 | | | +|%datetime |0 |@{%date}[ T]@{%time}(?:@{%timezone}| UTC)\|2016-12-31 23:37:22.525343 UTC | | |parseDateTime |ISO-8601 format date and time + simple va\+| | |\? |2016-12-31 23:37:22.525343 |2016-12-31 23:37:22.525343 EST | | |\riants +| | | |2016-12-31 23:37:22 | | | | +| | | |2016-12-31T23:37:22+0100 | | | | +| | | |2016-12-31T23:37:22-01:00 | | | | +| | | |2016-12-31T23:37:22-23:59 | | | | +| | | |2016-12-31T23:37:22Z | | | | +|%datetime.8601 |0 |@{%date}T@{%time}@{%timezone} |2016-12-31T23:37:22.343Z | | |parseDateTime8601|YYYY-MM-DDTHH:MM:SS[.Q*](Z|[+-]HHMM) form\+| | | |2016-12-31T23:37:22-0100 |2016-12-31 23:37:22.525343 EST | | |\at date and time +| | | |2016-12-31T23:37:22+23:59 | | | | +|%datetime.clf |0 |[0-9]{2}/@{%shortmonth}/[0-9]{4}:[0-9]{2}\|10/Oct/2000:13:55:36 -0700 | | |parseDateTimeCLF |Common Log Format date+time: %d/%b/%Y:%H:\+| | |\:[0-9]{2}:[0-9]{2} [+-][0-9]{2}:?[0-9]{2\|10/Oct/2000:13:55:36 +07:00 |2016-12-31T23:37+0100 | | |\%M:%S %z +| | |\} | |10/Oct/2000:13:55:36-0700 | | | +| | | | |10/OCT/2000:13:55:36 -0700 | | | +| | | | |10/Oct/2000:13:55 -0700 | | | +| | | | |10/Oct/2000:13:55Z | | | +|%email.simple |0 |[a-zA-Z0-9%_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0\|user-name%foo.bar.com@an-example.com | | |- |an email address +| | |\-9.-]+ | |not-an-email-address | | | +| | | | |@not-an-email-address | | | +|%frac |0 |-?[0-9]+(?:\.[0-9]+)? |0 | | |parseInteger |a decimal integer +| | | |1234567890 |0A | | | +| | | |00 |+0 | | | +| | | |01 |0. | | | +| | | |-1 |.0 | | | +| | | |-0 |. | | | +| | | |0.1234567890 |- | | | +| | | |-1.0 |-. | | | +| | | | |-1. | | | +| | | | |-.1 | | | +|%hex |0 |[0-9a-fA-F]+ |0 | | |parseHex |a string of one or more hexadecimal digit\+| | | |12345678 |0x10 | | |\s +| | | |0abcdef |0z | | | +| | | |0ABCDEF |-1a | | | +| | | |00 | | | | +| | | |010 | | | | +|%id |0 |_*[a-zA-Z][a-zA-Z0-9_]* |a | | |- |a standard C-style alphanumeric identifie\+| | | |A |1 | | |\r (with _s) +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |a' | | | +|%id' |0 |_*[a-zA-Z][a-zA-Z0-9_']* |a | | |- |a standard Haskell-style alphanumeric ide\+| | | |A |1 | | |\ntifier (with '_'s and '''s) +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |' | | | +| | | |a' |'a | | | +| | | |_a' |_' | | | +| | | |a'b |_1' | | | +|%id- |0 |_*[a-zA-Z][a-zA-Z0-9_'-]* |a | | |- |an identifier with -s +| | | |A |1 | | | +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |' | | | +| | | |a' |'a | | | +| | | |_a' |_' | | | +| | | |a'b |_1' | | | +| | | |a- | | | | +| | | |a1-B2 | | | | +| | | |a1-B2- | | | | +|%int |0 |-?[0-9]+ |0 | | |parseInteger |a decimal integer +| | | |1234567890 |0A | | | +| | | |00 |+0 | | | +| | | |01 | | | | +| | | |-1 | | | | +| | | |-0 | | | | +|%nat |0 |[0-9]+ |0 | | |parseInteger |a string of one or more decimal digits +| | | |1234567890 |0A | | | +| | | |00 |-1 | | | +| | | |01 | | | | +|%shortmonth |0 |(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oc\|Jan | | |parseShortMonth |three letter month name: Jan-Dec +| | |\t|Nov|Dec) |Feb |jan | | | +| | | |Dec |DEC | | | +| | | | |January | | | +| | | | |01 | | | +| | | | |1 | | | +|%string.simple |0 |"[^"[:cntrl:]]*" |"" | | |parseSimpleString|a decimal integer +| | | |"foo" |" | | | +| | | |"\" |"\"" | | | +| | | |"" |"\"\"" | | | +| | | | |"\"\\\"" | | | +| | | | |"\"foo\"" | | | +| | | | |"aa | | | +|%syslog.severity|0 |(?:emerg|panic|alert|crit|warning|warn|no\|emerg | | |parseSeverity |syslog severity keyword (debug-emerg) +| | |\tice|info|debug|err(?:or)?) |panic |Emergency | | | +| | | |alert |ALERT | | | +| | | |crit | | | | +| | | |err | | | | +| | | |error | | | | +| | | |warn | | | | +| | | |warning | | | | +| | | |notice | | | | +| | | |info | | | | +| | | |debug | | | | +|%time |0 |[0-9]{2}:[0-9]{2}:[0-9]{2}(?:[.][0-9]+)? |00:00:00 | | |parseTimeOfDay |a HH:MM:SS[.Q+] +| | | |23:59:59 |235959 | | | +| | | |00:00:00.1234567890 |10:20 | | | +| | | | |A00:00:00 | | | +| | | | |00:00:00A | | | +| | | | |23:59:59. | | | +|%timezone |0 |(?:Z|[+-][0-9]{2}:?[0-9]{2}) |Z | | |parseTimeZone |an IOS-8601 TZ specification +| | | |+00:00 |00 | | | +| | | |+0000 |A00:00 | | | +| | | |+0200 |UTC | | | +| | | |-0100 |EST | | | +| | | | | EST | | | +|%url |1 |([hH][tT][tT][pP][sS]?|[fF][tT][pP])://[^\|https://mathiasbynens.be/demo/url-regex | | |- |a URL +| | |\[:space:]/$.?#].[^[:space:]]* |http://foo.com/blah_blah |http:// | | | +| | | |http://foo.com/blah_blah/ |http://. | | | +| | | |http://foo.com/blah_blah_(wikipedia) |http://.. | | | +| | | |http://foo.com/blah_blah_(wikipedia)_(aga\|http://../ | | | +| | | |\in) |http://? | | | +| | | |http://www.example.com/wpstyle/?p=364 |http://?? | | | +| | | |HTTPS://foo.bar/?q=Test%20URL-encoded%20s\|http://foo.bar?q=Spaces should be encoded| | | +| | | |\tuff |// | | | +| | | |HTTP://223.255.255.254 |http://##/ | | | +| | | |ftp://223.255.255.254 |http://## | | | +| | | |FTP://223.255.255.254 |http://##/ | | | +|access |9 |(@{%address.ipv4}) - (@{user}) \[(@{%date\|192.168.100.200 - - [12/Jan/2016:12:08:36\| | |parse_a |an Nginx access log file line +| | |\time.clf})\] (@{%string.simple}) (@{%nat\|\ +0000] "GET / HTTP/1.1" 200 3700 "-" "M\| - [] "" "" "" "" | | | +| | |\}) (@{%nat}) (@{%string.simple}) (@{%str\|\y Agent" "-" | | | | +| | |\ing.simple}) (@{%string.simple}) | | | | | +|access_deg |0 | - \[\] "" "" "" "" | - [] "" "" "" "" | | |- |a degenerate Nginx access log file line +| | | | |foo | | | +|error |5 |(@{%date.slashes}) (@{%time}) \[(@{%syslo\|2016/12/21 11:53:35 [emerg] 1378#0: foo | | |parse_e |an Nginx error log file line +| | |\g.severity})\] (@{pid#tid:})(.*) |2017/01/04 05:40:19 [error] 31623#0: *186\|foo | | | +| | | |\1296 no "ssl_certificate" is defined in \| | | | +| | | |\server listening on SSL port while SSL h\| | | | +| | | |\andshaking, client: 192.168.31.38, serve\| | | | +| | | |\r: 0.0.0.0:80 | | | | +|pid#tid: |0 |(?:@{%nat})#(?:@{%nat}): |1378#0: | | |parse_pid_tid |<PID>#<TID>: +| | | | |24#: | | | +| | | | |24.365: | | | +|user |0 |(?:-|[^[:space:]]+) |joe |joe user | |parse_user |a user ident (per RFC1413)
+ data/tdfa-macros.txt view
@@ -0,0 +1,150 @@+|name |caps|regex=regex=regex=regex=regex |examples |anti-examples |fails|parser |comment +|----------------|----|------------------------------------------|------------------------------------------|-----------------------------------------|-----|-----------------|------------------------------------------+|%address.ipv4 |0 |[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0\|0.0.0.0 | | |parseSeverity |an a.b.c.d IPv4 address +| | |\-9]{1,3} |123.45.6.78 |foo | | | +| | | |9.9.9.9 |1234.0.0.0 | | | +| | | |255.255.255.255 |1.2.3 | | | +| | | | |1.2.3. | | | +| | | | |1.2..4 | | | +| | | | |www.example.com | | | +| | | | |2001:0db8:85a3:0000:0000:8a2e:0370:7334 | | | +|%date |0 |[0-9]{4}-[0-9]{2}-[0-9]{2} |2016-12-31 | | |parseDate |a YYYY-MM-DD format date +| | | |0001-01-01 |2016/01/31 | | | +| | | |1000-01-01 |2016-1-31 | | | +| | | | |2016-01-1 | | | +| | | | |2016-001-01 | | | +|%date.slashes |0 |[0-9]{4}/[0-9]{2}/[0-9]{2} |2016/12/31 | | |parseSlashesDate |a YYYY/MM/DD format date +| | | |0001/01/01 |2016-01-31 | | | +| | | |1000/01/01 |2016/1/31 | | | +| | | | |2016/01/1 | | | +| | | | |2016/001/01 | | | +|%datetime |1 |@{%date}[ T]@{%time}(@{%timezone}| UTC)? |2016-12-31 23:37:22.525343 UTC | | |parseDateTime |ISO-8601 format date and time + simple va\+| | | |2016-12-31 23:37:22.525343 |2016-12-31 23:37:22.525343 EST | | |\riants +| | | |2016-12-31 23:37:22 | | | | +| | | |2016-12-31T23:37:22+0100 | | | | +| | | |2016-12-31T23:37:22-01:00 | | | | +| | | |2016-12-31T23:37:22-23:59 | | | | +| | | |2016-12-31T23:37:22Z | | | | +|%datetime.8601 |0 |@{%date}T@{%time}@{%timezone} |2016-12-31T23:37:22.343Z | | |parseDateTime8601|YYYY-MM-DDTHH:MM:SS[.Q*](Z|[+-]HHMM) form\+| | | |2016-12-31T23:37:22-0100 |2016-12-31 23:37:22.525343 EST | | |\at date and time +| | | |2016-12-31T23:37:22+23:59 | | | | +|%datetime.clf |0 |[0-9]{2}/@{%shortmonth}/[0-9]{4}:[0-9]{2}\|10/Oct/2000:13:55:36 -0700 | | |parseDateTimeCLF |Common Log Format date+time: %d/%b/%Y:%H:\+| | |\:[0-9]{2}:[0-9]{2} [+-][0-9]{2}:?[0-9]{2\|10/Oct/2000:13:55:36 +07:00 |2016-12-31T23:37+0100 | | |\%M:%S %z +| | |\} | |10/Oct/2000:13:55:36-0700 | | | +| | | | |10/OCT/2000:13:55:36 -0700 | | | +| | | | |10/Oct/2000:13:55 -0700 | | | +| | | | |10/Oct/2000:13:55Z | | | +|%email.simple |0 |[a-zA-Z0-9%_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0\|user-name%foo.bar.com@an-example.com | | |- |an email address +| | |\-9.-]+ | |not-an-email-address | | | +| | | | |@not-an-email-address | | | +|%frac |1 |-?[0-9]+(\.[0-9]+)? |0 | | |parseInteger |a decimal integer +| | | |1234567890 |0A | | | +| | | |00 |+0 | | | +| | | |01 |0. | | | +| | | |-1 |.0 | | | +| | | |-0 |. | | | +| | | |0.1234567890 |- | | | +| | | |-1.0 |-. | | | +| | | | |-1. | | | +| | | | |-.1 | | | +|%hex |0 |[0-9a-fA-F]+ |0 | | |parseHex |a string of one or more hexadecimal digit\+| | | |12345678 |0x10 | | |\s +| | | |0abcdef |0z | | | +| | | |0ABCDEF |-1a | | | +| | | |00 | | | | +| | | |010 | | | | +|%id |0 |_*[a-zA-Z][a-zA-Z0-9_]* |a | | |- |a standard C-style alphanumeric identifie\+| | | |A |1 | | |\r (with _s) +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |a' | | | +|%id' |0 |_*[a-zA-Z][a-zA-Z0-9_']* |a | | |- |a standard Haskell-style alphanumeric ide\+| | | |A |1 | | |\ntifier (with '_'s and '''s) +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |' | | | +| | | |a' |'a | | | +| | | |_a' |_' | | | +| | | |a'b |_1' | | | +|%id- |0 |_*[a-zA-Z][a-zA-Z0-9_'-]* |a | | |- |an identifier with -s +| | | |A |1 | | | +| | | |A1 |_ | | | +| | | |a_ |__ | | | +| | | |a1_B2 |__1 | | | +| | | |_abc |1a | | | +| | | |__abc |' | | | +| | | |a' |'a | | | +| | | |_a' |_' | | | +| | | |a'b |_1' | | | +| | | |a- | | | | +| | | |a1-B2 | | | | +| | | |a1-B2- | | | | +|%int |0 |-?[0-9]+ |0 | | |parseInteger |a decimal integer +| | | |1234567890 |0A | | | +| | | |00 |+0 | | | +| | | |01 | | | | +| | | |-1 | | | | +| | | |-0 | | | | +|%nat |0 |[0-9]+ |0 | | |parseInteger |a string of one or more decimal digits +| | | |1234567890 |0A | | | +| | | |00 |-1 | | | +| | | |01 | | | | +|%shortmonth |1 |(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|\|Jan | | |parseShortMonth |three letter month name: Jan-Dec +| | |\Nov|Dec) |Feb |jan | | | +| | | |Dec |DEC | | | +| | | | |January | | | +| | | | |01 | | | +| | | | |1 | | | +|%string |1 |"([^"\]+|\\[\"])*" |"" |" | |parseString |a double-quote string, with simple \ esca\+| | | |"foo" |"aa | | |\pes for \s and "s +| | | |"\"" | | | | +| | | |"\"\"" | | | | +| | | |"\"\\\"" | | | | +| | | |"\"foo\"" | | | | +| | | |"" | | | | +|%string.simple |0 |"[^"[:cntrl:]]*" |"" | | |parseSimpleString|a decimal integer +| | | |"foo" |" | | | +| | | |"\" |"\"" | | | +| | | |"" |"\"\"" | | | +| | | | |"\"\\\"" | | | +| | | | |"\"foo\"" | | | +| | | | |"aa | | | +|%syslog.severity|1 |(emerg|panic|alert|crit|err|error|warning\|emerg | | |parseSeverity |syslog severity keyword (debug-emerg) +| | |\|warn|notice|info|debug) |panic |Emergency | | | +| | | |alert |ALERT | | | +| | | |crit | | | | +| | | |err | | | | +| | | |error | | | | +| | | |warn | | | | +| | | |warning | | | | +| | | |notice | | | | +| | | |info | | | | +| | | |debug | | | | +|%time |1 |[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]+)? |00:00:00 | | |parseTimeOfDay |a HH:MM:SS[.Q+] +| | | |23:59:59 |235959 | | | +| | | |00:00:00.1234567890 |10:20 | | | +| | | | |A00:00:00 | | | +| | | | |00:00:00A | | | +| | | | |23:59:59. | | | +|%timezone |1 |(Z|[+-][0-9]{2}:?[0-9]{2}) |Z | | |parseTimeZone |an IOS-8601 TZ specification +| | | |+00:00 |00 | | | +| | | |+0000 |A00:00 | | | +| | | |+0200 |UTC | | | +| | | |-0100 |EST | | | +| | | | | EST | | | +|%url |1 |([hH][tT][tT][pP][sS]?|[fF][tT][pP])://[^\|https://mathiasbynens.be/demo/url-regex | | |- |a URL +| | |\[:space:]/$.?#].[^[:space:]]* |http://foo.com/blah_blah |http:// | | | +| | | |http://foo.com/blah_blah/ |http://. | | | +| | | |http://foo.com/blah_blah_(wikipedia) |http://.. | | | +| | | |http://foo.com/blah_blah_(wikipedia)_(aga\|http://../ | | | +| | | |\in) |http://? | | | +| | | |http://www.example.com/wpstyle/?p=364 |http://?? | | | +| | | |HTTPS://foo.bar/?q=Test%20URL-encoded%20s\|http://foo.bar?q=Spaces should be encoded| | | +| | | |\tuff |// | | | +| | | |HTTP://223.255.255.254 |http://##/ | | | +| | | |ftp://223.255.255.254 |http://## | | | +| | | |FTP://223.255.255.254 |http://##/ | | |
− docs/pcre-macros.txt
@@ -1,143 +0,0 @@-|name |caps|regex=regex=regex=regex=regex |examples |anti-examples |fails|parser |comment -|----------------|----|------------------------------------------|------------------------------------------|-----------------------------------------|-----|-----------------|-------------------------------------------|%address.ipv4 |0 |[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0\|0.0.0.0 | | |parseSeverity |an a.b.c.d IPv4 address -| | |\-9]{1,3} |123.45.6.78 |foo | | | -| | | |9.9.9.9 |1234.0.0.0 | | | -| | | |255.255.255.255 |1.2.3 | | | -| | | | |1.2.3. | | | -| | | | |1.2..4 | | | -| | | | |www.example.com | | | -| | | | |2001:0db8:85a3:0000:0000:8a2e:0370:7334 | | | -|%date |0 |[0-9]{4}-[0-9]{2}-[0-9]{2} |2016-12-31 | | |parseDate |a YYYY-MM-DD format date -| | | |0001-01-01 |2016/01/31 | | | -| | | |1000-01-01 |2016-1-31 | | | -| | | | |2016-01-1 | | | -| | | | |2016-001-01 | | | -|%date.slashes |0 |[0-9]{4}/[0-9]{2}/[0-9]{2} |2016/12/31 | | |parseSlashesDate |a YYYY/MM/DD format date -| | | |0001/01/01 |2016-01-31 | | | -| | | |1000/01/01 |2016/1/31 | | | -| | | | |2016/01/1 | | | -| | | | |2016/001/01 | | | -|%datetime |0 |@{%date}[ T]@{%time}(?:@{%timezone}| UTC)\|2016-12-31 23:37:22.525343 UTC | | |parseDateTime |ISO-8601 format date and time + simple va\-| | |\? |2016-12-31 23:37:22.525343 |2016-12-31 23:37:22.525343 EST | | |\riants -| | | |2016-12-31 23:37:22 | | | | -| | | |2016-12-31T23:37:22+0100 | | | | -| | | |2016-12-31T23:37:22-01:00 | | | | -| | | |2016-12-31T23:37:22-23:59 | | | | -| | | |2016-12-31T23:37:22Z | | | | -|%datetime.8601 |0 |@{%date}T@{%time}@{%timezone} |2016-12-31T23:37:22.343Z | | |parseDateTime8601|YYYY-MM-DDTHH:MM:SS[.Q*](Z|[+-]HHMM) form\-| | | |2016-12-31T23:37:22-0100 |2016-12-31 23:37:22.525343 EST | | |\at date and time -| | | |2016-12-31T23:37:22+23:59 | | | | -|%datetime.clf |0 |[0-9]{2}/@{%shortmonth}/[0-9]{4}:[0-9]{2}\|10/Oct/2000:13:55:36 -0700 | | |parseDateTimeCLF |Common Log Format date+time: %d/%b/%Y:%H:\-| | |\:[0-9]{2}:[0-9]{2} [+-][0-9]{2}:?[0-9]{2\|10/Oct/2000:13:55:36 +07:00 |2016-12-31T23:37+0100 | | |\%M:%S %z -| | |\} | |10/Oct/2000:13:55:36-0700 | | | -| | | | |10/OCT/2000:13:55:36 -0700 | | | -| | | | |10/Oct/2000:13:55 -0700 | | | -| | | | |10/Oct/2000:13:55Z | | | -|%email.simple |0 |[a-zA-Z0-9%_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0\|user-name%foo.bar.com@an-example.com | | |- |an email address -| | |\-9.-]+ | |not-an-email-address | | | -| | | | |@not-an-email-address | | | -|%frac |0 |-?[0-9]+(?:\.[0-9]+)? |0 | | |parseInteger |a decimal integer -| | | |1234567890 |0A | | | -| | | |00 |+0 | | | -| | | |01 |0. | | | -| | | |-1 |.0 | | | -| | | |-0 |. | | | -| | | |0.1234567890 |- | | | -| | | |-1.0 |-. | | | -| | | | |-1. | | | -| | | | |-.1 | | | -|%hex |0 |[0-9a-fA-F]+ |0 | | |parseHex |a string of one or more hexadecimal digit\-| | | |12345678 |0x10 | | |\s -| | | |0abcdef |0z | | | -| | | |0ABCDEF |-1a | | | -| | | |00 | | | | -| | | |010 | | | | -|%id |0 |_*[a-zA-Z][a-zA-Z0-9_]* |a | | |- |a standard C-style alphanumeric identifie\-| | | |A |1 | | |\r (with _s) -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |a' | | | -|%id' |0 |_*[a-zA-Z][a-zA-Z0-9_']* |a | | |- |a standard Haskell-style alphanumeric ide\-| | | |A |1 | | |\ntifier (with '_'s and '''s) -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |' | | | -| | | |a' |'a | | | -| | | |_a' |_' | | | -| | | |a'b |_1' | | | -|%id- |0 |_*[a-zA-Z][a-zA-Z0-9_'-]* |a | | |- |an identifier with -s -| | | |A |1 | | | -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |' | | | -| | | |a' |'a | | | -| | | |_a' |_' | | | -| | | |a'b |_1' | | | -| | | |a- | | | | -| | | |a1-B2 | | | | -| | | |a1-B2- | | | | -|%int |0 |-?[0-9]+ |0 | | |parseInteger |a decimal integer -| | | |1234567890 |0A | | | -| | | |00 |+0 | | | -| | | |01 | | | | -| | | |-1 | | | | -| | | |-0 | | | | -|%nat |0 |[0-9]+ |0 | | |parseInteger |a string of one or more decimal digits -| | | |1234567890 |0A | | | -| | | |00 |-1 | | | -| | | |01 | | | | -|%shortmonth |0 |(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oc\|Jan | | |parseShortMonth |three letter month name: Jan-Dec -| | |\t|Nov|Dec) |Feb |jan | | | -| | | |Dec |DEC | | | -| | | | |January | | | -| | | | |01 | | | -| | | | |1 | | | -|%string.simple |0 |"[^"[:cntrl:]]*" |"" | | |parseSimpleString|a decimal integer -| | | |"foo" |" | | | -| | | |"\" |"\"" | | | -| | | |"" |"\"\"" | | | -| | | | |"\"\\\"" | | | -| | | | |"\"foo\"" | | | -| | | | |"aa | | | -|%syslog.severity|0 |(?:emerg|panic|alert|crit|warning|warn|no\|emerg | | |parseSeverity |syslog severity keyword (debug-emerg) -| | |\tice|info|debug|err(?:or)?) |panic |Emergency | | | -| | | |alert |ALERT | | | -| | | |crit | | | | -| | | |err | | | | -| | | |error | | | | -| | | |warn | | | | -| | | |warning | | | | -| | | |notice | | | | -| | | |info | | | | -| | | |debug | | | | -|%time |0 |[0-9]{2}:[0-9]{2}:[0-9]{2}(?:[.][0-9]+)? |00:00:00 | | |parseTimeOfDay |a HH:MM:SS[.Q+] -| | | |23:59:59 |235959 | | | -| | | |00:00:00.1234567890 |10:20 | | | -| | | | |A00:00:00 | | | -| | | | |00:00:00A | | | -| | | | |23:59:59. | | | -|%timezone |0 |(?:Z|[+-][0-9]{2}:?[0-9]{2}) |Z | | |parseTimeZone |an IOS-8601 TZ specification -| | | |+00:00 |00 | | | -| | | |+0000 |A00:00 | | | -| | | |+0200 |UTC | | | -| | | |-0100 |EST | | | -| | | | | EST | | | -|%url |1 |([hH][tT][tT][pP][sS]?|[fF][tT][pP])://[^\|https://mathiasbynens.be/demo/url-regex | | |- |a URL -| | |\[:space:]/$.?#].[^[:space:]]* |http://foo.com/blah_blah |http:// | | | -| | | |http://foo.com/blah_blah/ |http://. | | | -| | | |http://foo.com/blah_blah_(wikipedia) |http://.. | | | -| | | |http://foo.com/blah_blah_(wikipedia)_(aga\|http://../ | | | -| | | |\in) |http://? | | | -| | | |http://www.example.com/wpstyle/?p=364 |http://?? | | | -| | | |HTTPS://foo.bar/?q=Test%20URL-encoded%20s\|http://foo.bar?q=Spaces should be encoded| | | -| | | |\tuff |// | | | -| | | |HTTP://223.255.255.254 |http://##/ | | | -| | | |ftp://223.255.255.254 |http://## | | | -| | | |FTP://223.255.255.254 |http://##/ | | |
− docs/pcre-nginx-log-processor.txt
@@ -1,159 +0,0 @@-|name |caps|regex=regex=regex=regex=regex |examples |anti-examples |fails|parser |comment -|----------------|----|------------------------------------------|------------------------------------------|-----------------------------------------|-----|-----------------|-------------------------------------------|%address.ipv4 |0 |[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0\|0.0.0.0 | | |parseSeverity |an a.b.c.d IPv4 address -| | |\-9]{1,3} |123.45.6.78 |foo | | | -| | | |9.9.9.9 |1234.0.0.0 | | | -| | | |255.255.255.255 |1.2.3 | | | -| | | | |1.2.3. | | | -| | | | |1.2..4 | | | -| | | | |www.example.com | | | -| | | | |2001:0db8:85a3:0000:0000:8a2e:0370:7334 | | | -|%date |0 |[0-9]{4}-[0-9]{2}-[0-9]{2} |2016-12-31 | | |parseDate |a YYYY-MM-DD format date -| | | |0001-01-01 |2016/01/31 | | | -| | | |1000-01-01 |2016-1-31 | | | -| | | | |2016-01-1 | | | -| | | | |2016-001-01 | | | -|%date.slashes |0 |[0-9]{4}/[0-9]{2}/[0-9]{2} |2016/12/31 | | |parseSlashesDate |a YYYY/MM/DD format date -| | | |0001/01/01 |2016-01-31 | | | -| | | |1000/01/01 |2016/1/31 | | | -| | | | |2016/01/1 | | | -| | | | |2016/001/01 | | | -|%datetime |0 |@{%date}[ T]@{%time}(?:@{%timezone}| UTC)\|2016-12-31 23:37:22.525343 UTC | | |parseDateTime |ISO-8601 format date and time + simple va\-| | |\? |2016-12-31 23:37:22.525343 |2016-12-31 23:37:22.525343 EST | | |\riants -| | | |2016-12-31 23:37:22 | | | | -| | | |2016-12-31T23:37:22+0100 | | | | -| | | |2016-12-31T23:37:22-01:00 | | | | -| | | |2016-12-31T23:37:22-23:59 | | | | -| | | |2016-12-31T23:37:22Z | | | | -|%datetime.8601 |0 |@{%date}T@{%time}@{%timezone} |2016-12-31T23:37:22.343Z | | |parseDateTime8601|YYYY-MM-DDTHH:MM:SS[.Q*](Z|[+-]HHMM) form\-| | | |2016-12-31T23:37:22-0100 |2016-12-31 23:37:22.525343 EST | | |\at date and time -| | | |2016-12-31T23:37:22+23:59 | | | | -|%datetime.clf |0 |[0-9]{2}/@{%shortmonth}/[0-9]{4}:[0-9]{2}\|10/Oct/2000:13:55:36 -0700 | | |parseDateTimeCLF |Common Log Format date+time: %d/%b/%Y:%H:\-| | |\:[0-9]{2}:[0-9]{2} [+-][0-9]{2}:?[0-9]{2\|10/Oct/2000:13:55:36 +07:00 |2016-12-31T23:37+0100 | | |\%M:%S %z -| | |\} | |10/Oct/2000:13:55:36-0700 | | | -| | | | |10/OCT/2000:13:55:36 -0700 | | | -| | | | |10/Oct/2000:13:55 -0700 | | | -| | | | |10/Oct/2000:13:55Z | | | -|%email.simple |0 |[a-zA-Z0-9%_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0\|user-name%foo.bar.com@an-example.com | | |- |an email address -| | |\-9.-]+ | |not-an-email-address | | | -| | | | |@not-an-email-address | | | -|%frac |0 |-?[0-9]+(?:\.[0-9]+)? |0 | | |parseInteger |a decimal integer -| | | |1234567890 |0A | | | -| | | |00 |+0 | | | -| | | |01 |0. | | | -| | | |-1 |.0 | | | -| | | |-0 |. | | | -| | | |0.1234567890 |- | | | -| | | |-1.0 |-. | | | -| | | | |-1. | | | -| | | | |-.1 | | | -|%hex |0 |[0-9a-fA-F]+ |0 | | |parseHex |a string of one or more hexadecimal digit\-| | | |12345678 |0x10 | | |\s -| | | |0abcdef |0z | | | -| | | |0ABCDEF |-1a | | | -| | | |00 | | | | -| | | |010 | | | | -|%id |0 |_*[a-zA-Z][a-zA-Z0-9_]* |a | | |- |a standard C-style alphanumeric identifie\-| | | |A |1 | | |\r (with _s) -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |a' | | | -|%id' |0 |_*[a-zA-Z][a-zA-Z0-9_']* |a | | |- |a standard Haskell-style alphanumeric ide\-| | | |A |1 | | |\ntifier (with '_'s and '''s) -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |' | | | -| | | |a' |'a | | | -| | | |_a' |_' | | | -| | | |a'b |_1' | | | -|%id- |0 |_*[a-zA-Z][a-zA-Z0-9_'-]* |a | | |- |an identifier with -s -| | | |A |1 | | | -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |' | | | -| | | |a' |'a | | | -| | | |_a' |_' | | | -| | | |a'b |_1' | | | -| | | |a- | | | | -| | | |a1-B2 | | | | -| | | |a1-B2- | | | | -|%int |0 |-?[0-9]+ |0 | | |parseInteger |a decimal integer -| | | |1234567890 |0A | | | -| | | |00 |+0 | | | -| | | |01 | | | | -| | | |-1 | | | | -| | | |-0 | | | | -|%nat |0 |[0-9]+ |0 | | |parseInteger |a string of one or more decimal digits -| | | |1234567890 |0A | | | -| | | |00 |-1 | | | -| | | |01 | | | | -|%shortmonth |0 |(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oc\|Jan | | |parseShortMonth |three letter month name: Jan-Dec -| | |\t|Nov|Dec) |Feb |jan | | | -| | | |Dec |DEC | | | -| | | | |January | | | -| | | | |01 | | | -| | | | |1 | | | -|%string.simple |0 |"[^"[:cntrl:]]*" |"" | | |parseSimpleString|a decimal integer -| | | |"foo" |" | | | -| | | |"\" |"\"" | | | -| | | |"" |"\"\"" | | | -| | | | |"\"\\\"" | | | -| | | | |"\"foo\"" | | | -| | | | |"aa | | | -|%syslog.severity|0 |(?:emerg|panic|alert|crit|warning|warn|no\|emerg | | |parseSeverity |syslog severity keyword (debug-emerg) -| | |\tice|info|debug|err(?:or)?) |panic |Emergency | | | -| | | |alert |ALERT | | | -| | | |crit | | | | -| | | |err | | | | -| | | |error | | | | -| | | |warn | | | | -| | | |warning | | | | -| | | |notice | | | | -| | | |info | | | | -| | | |debug | | | | -|%time |0 |[0-9]{2}:[0-9]{2}:[0-9]{2}(?:[.][0-9]+)? |00:00:00 | | |parseTimeOfDay |a HH:MM:SS[.Q+] -| | | |23:59:59 |235959 | | | -| | | |00:00:00.1234567890 |10:20 | | | -| | | | |A00:00:00 | | | -| | | | |00:00:00A | | | -| | | | |23:59:59. | | | -|%timezone |0 |(?:Z|[+-][0-9]{2}:?[0-9]{2}) |Z | | |parseTimeZone |an IOS-8601 TZ specification -| | | |+00:00 |00 | | | -| | | |+0000 |A00:00 | | | -| | | |+0200 |UTC | | | -| | | |-0100 |EST | | | -| | | | | EST | | | -|%url |1 |([hH][tT][tT][pP][sS]?|[fF][tT][pP])://[^\|https://mathiasbynens.be/demo/url-regex | | |- |a URL -| | |\[:space:]/$.?#].[^[:space:]]* |http://foo.com/blah_blah |http:// | | | -| | | |http://foo.com/blah_blah/ |http://. | | | -| | | |http://foo.com/blah_blah_(wikipedia) |http://.. | | | -| | | |http://foo.com/blah_blah_(wikipedia)_(aga\|http://../ | | | -| | | |\in) |http://? | | | -| | | |http://www.example.com/wpstyle/?p=364 |http://?? | | | -| | | |HTTPS://foo.bar/?q=Test%20URL-encoded%20s\|http://foo.bar?q=Spaces should be encoded| | | -| | | |\tuff |// | | | -| | | |HTTP://223.255.255.254 |http://##/ | | | -| | | |ftp://223.255.255.254 |http://## | | | -| | | |FTP://223.255.255.254 |http://##/ | | | -|access |9 |(@{%address.ipv4}) - (@{user}) \[(@{%date\|192.168.100.200 - - [12/Jan/2016:12:08:36\| | |parse_a |an Nginx access log file line -| | |\time.clf})\] (@{%string.simple}) (@{%nat\|\ +0000] "GET / HTTP/1.1" 200 3700 "-" "M\| - [] "" "" "" "" | | | -| | |\}) (@{%nat}) (@{%string.simple}) (@{%str\|\y Agent" "-" | | | | -| | |\ing.simple}) (@{%string.simple}) | | | | | -|access_deg |0 | - \[\] "" "" "" "" | - [] "" "" "" "" | | |- |a degenerate Nginx access log file line -| | | | |foo | | | -|error |5 |(@{%date.slashes}) (@{%time}) \[(@{%syslo\|2016/12/21 11:53:35 [emerg] 1378#0: foo | | |parse_e |an Nginx error log file line -| | |\g.severity})\] (@{pid#tid:})(.*) |2017/01/04 05:40:19 [error] 31623#0: *186\|foo | | | -| | | |\1296 no "ssl_certificate" is defined in \| | | | -| | | |\server listening on SSL port while SSL h\| | | | -| | | |\andshaking, client: 192.168.31.38, serve\| | | | -| | | |\r: 0.0.0.0:80 | | | | -|pid#tid: |0 |(?:@{%nat})#(?:@{%nat}): |1378#0: | | |parse_pid_tid |<PID>#<TID>: -| | | | |24#: | | | -| | | | |24.365: | | | -|user |0 |(?:-|[^[:space:]]+) |joe |joe user | |parse_user |a user ident (per RFC1413)
− docs/tdfa-macros.txt
@@ -1,150 +0,0 @@-|name |caps|regex=regex=regex=regex=regex |examples |anti-examples |fails|parser |comment -|----------------|----|------------------------------------------|------------------------------------------|-----------------------------------------|-----|-----------------|-------------------------------------------|%address.ipv4 |0 |[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0\|0.0.0.0 | | |parseSeverity |an a.b.c.d IPv4 address -| | |\-9]{1,3} |123.45.6.78 |foo | | | -| | | |9.9.9.9 |1234.0.0.0 | | | -| | | |255.255.255.255 |1.2.3 | | | -| | | | |1.2.3. | | | -| | | | |1.2..4 | | | -| | | | |www.example.com | | | -| | | | |2001:0db8:85a3:0000:0000:8a2e:0370:7334 | | | -|%date |0 |[0-9]{4}-[0-9]{2}-[0-9]{2} |2016-12-31 | | |parseDate |a YYYY-MM-DD format date -| | | |0001-01-01 |2016/01/31 | | | -| | | |1000-01-01 |2016-1-31 | | | -| | | | |2016-01-1 | | | -| | | | |2016-001-01 | | | -|%date.slashes |0 |[0-9]{4}/[0-9]{2}/[0-9]{2} |2016/12/31 | | |parseSlashesDate |a YYYY/MM/DD format date -| | | |0001/01/01 |2016-01-31 | | | -| | | |1000/01/01 |2016/1/31 | | | -| | | | |2016/01/1 | | | -| | | | |2016/001/01 | | | -|%datetime |1 |@{%date}[ T]@{%time}(@{%timezone}| UTC)? |2016-12-31 23:37:22.525343 UTC | | |parseDateTime |ISO-8601 format date and time + simple va\-| | | |2016-12-31 23:37:22.525343 |2016-12-31 23:37:22.525343 EST | | |\riants -| | | |2016-12-31 23:37:22 | | | | -| | | |2016-12-31T23:37:22+0100 | | | | -| | | |2016-12-31T23:37:22-01:00 | | | | -| | | |2016-12-31T23:37:22-23:59 | | | | -| | | |2016-12-31T23:37:22Z | | | | -|%datetime.8601 |0 |@{%date}T@{%time}@{%timezone} |2016-12-31T23:37:22.343Z | | |parseDateTime8601|YYYY-MM-DDTHH:MM:SS[.Q*](Z|[+-]HHMM) form\-| | | |2016-12-31T23:37:22-0100 |2016-12-31 23:37:22.525343 EST | | |\at date and time -| | | |2016-12-31T23:37:22+23:59 | | | | -|%datetime.clf |0 |[0-9]{2}/@{%shortmonth}/[0-9]{4}:[0-9]{2}\|10/Oct/2000:13:55:36 -0700 | | |parseDateTimeCLF |Common Log Format date+time: %d/%b/%Y:%H:\-| | |\:[0-9]{2}:[0-9]{2} [+-][0-9]{2}:?[0-9]{2\|10/Oct/2000:13:55:36 +07:00 |2016-12-31T23:37+0100 | | |\%M:%S %z -| | |\} | |10/Oct/2000:13:55:36-0700 | | | -| | | | |10/OCT/2000:13:55:36 -0700 | | | -| | | | |10/Oct/2000:13:55 -0700 | | | -| | | | |10/Oct/2000:13:55Z | | | -|%email.simple |0 |[a-zA-Z0-9%_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0\|user-name%foo.bar.com@an-example.com | | |- |an email address -| | |\-9.-]+ | |not-an-email-address | | | -| | | | |@not-an-email-address | | | -|%frac |1 |-?[0-9]+(\.[0-9]+)? |0 | | |parseInteger |a decimal integer -| | | |1234567890 |0A | | | -| | | |00 |+0 | | | -| | | |01 |0. | | | -| | | |-1 |.0 | | | -| | | |-0 |. | | | -| | | |0.1234567890 |- | | | -| | | |-1.0 |-. | | | -| | | | |-1. | | | -| | | | |-.1 | | | -|%hex |0 |[0-9a-fA-F]+ |0 | | |parseHex |a string of one or more hexadecimal digit\-| | | |12345678 |0x10 | | |\s -| | | |0abcdef |0z | | | -| | | |0ABCDEF |-1a | | | -| | | |00 | | | | -| | | |010 | | | | -|%id |0 |_*[a-zA-Z][a-zA-Z0-9_]* |a | | |- |a standard C-style alphanumeric identifie\-| | | |A |1 | | |\r (with _s) -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |a' | | | -|%id' |0 |_*[a-zA-Z][a-zA-Z0-9_']* |a | | |- |a standard Haskell-style alphanumeric ide\-| | | |A |1 | | |\ntifier (with '_'s and '''s) -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |' | | | -| | | |a' |'a | | | -| | | |_a' |_' | | | -| | | |a'b |_1' | | | -|%id- |0 |_*[a-zA-Z][a-zA-Z0-9_'-]* |a | | |- |an identifier with -s -| | | |A |1 | | | -| | | |A1 |_ | | | -| | | |a_ |__ | | | -| | | |a1_B2 |__1 | | | -| | | |_abc |1a | | | -| | | |__abc |' | | | -| | | |a' |'a | | | -| | | |_a' |_' | | | -| | | |a'b |_1' | | | -| | | |a- | | | | -| | | |a1-B2 | | | | -| | | |a1-B2- | | | | -|%int |0 |-?[0-9]+ |0 | | |parseInteger |a decimal integer -| | | |1234567890 |0A | | | -| | | |00 |+0 | | | -| | | |01 | | | | -| | | |-1 | | | | -| | | |-0 | | | | -|%nat |0 |[0-9]+ |0 | | |parseInteger |a string of one or more decimal digits -| | | |1234567890 |0A | | | -| | | |00 |-1 | | | -| | | |01 | | | | -|%shortmonth |1 |(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|\|Jan | | |parseShortMonth |three letter month name: Jan-Dec -| | |\Nov|Dec) |Feb |jan | | | -| | | |Dec |DEC | | | -| | | | |January | | | -| | | | |01 | | | -| | | | |1 | | | -|%string |1 |"([^"\]+|\\[\"])*" |"" |" | |parseString |a double-quote string, with simple \ esca\-| | | |"foo" |"aa | | |\pes for \s and "s -| | | |"\"" | | | | -| | | |"\"\"" | | | | -| | | |"\"\\\"" | | | | -| | | |"\"foo\"" | | | | -| | | |"" | | | | -|%string.simple |0 |"[^"[:cntrl:]]*" |"" | | |parseSimpleString|a decimal integer -| | | |"foo" |" | | | -| | | |"\" |"\"" | | | -| | | |"" |"\"\"" | | | -| | | | |"\"\\\"" | | | -| | | | |"\"foo\"" | | | -| | | | |"aa | | | -|%syslog.severity|1 |(emerg|panic|alert|crit|err|error|warning\|emerg | | |parseSeverity |syslog severity keyword (debug-emerg) -| | |\|warn|notice|info|debug) |panic |Emergency | | | -| | | |alert |ALERT | | | -| | | |crit | | | | -| | | |err | | | | -| | | |error | | | | -| | | |warn | | | | -| | | |warning | | | | -| | | |notice | | | | -| | | |info | | | | -| | | |debug | | | | -|%time |1 |[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]+)? |00:00:00 | | |parseTimeOfDay |a HH:MM:SS[.Q+] -| | | |23:59:59 |235959 | | | -| | | |00:00:00.1234567890 |10:20 | | | -| | | | |A00:00:00 | | | -| | | | |00:00:00A | | | -| | | | |23:59:59. | | | -|%timezone |1 |(Z|[+-][0-9]{2}:?[0-9]{2}) |Z | | |parseTimeZone |an IOS-8601 TZ specification -| | | |+00:00 |00 | | | -| | | |+0000 |A00:00 | | | -| | | |+0200 |UTC | | | -| | | |-0100 |EST | | | -| | | | | EST | | | -|%url |1 |([hH][tT][tT][pP][sS]?|[fF][tT][pP])://[^\|https://mathiasbynens.be/demo/url-regex | | |- |a URL -| | |\[:space:]/$.?#].[^[:space:]]* |http://foo.com/blah_blah |http:// | | | -| | | |http://foo.com/blah_blah/ |http://. | | | -| | | |http://foo.com/blah_blah_(wikipedia) |http://.. | | | -| | | |http://foo.com/blah_blah_(wikipedia)_(aga\|http://../ | | | -| | | |\in) |http://? | | | -| | | |http://www.example.com/wpstyle/?p=364 |http://?? | | | -| | | |HTTPS://foo.bar/?q=Test%20URL-encoded%20s\|http://foo.bar?q=Spaces should be encoded| | | -| | | |\tuff |// | | | -| | | |HTTP://223.255.255.254 |http://##/ | | | -| | | |ftp://223.255.255.254 |http://## | | | -| | | |FTP://223.255.255.254 |http://##/ | | |
examples/re-nginx-log-processor.lhs view
@@ -29,6 +29,7 @@ import Control.Exception import Control.Monad import qualified Data.ByteString.Lazy.Char8 as LBS+import Data.Char import qualified Data.HashMap.Lazy as HML import Data.Functor.Identity import Data.Maybe@@ -38,6 +39,7 @@ import Prelude.Compat import qualified Shelly as SH import System.Directory+import System.FilePath import System.Environment import System.Exit import System.IO@@ -81,7 +83,7 @@ , prg " --regex" , prg " --regex <macro-id>" , prg "[--test]"- , prg "(-|<in-file>) [-|<out-fileß>]"+ , prg "(-|<in-file>) [-|<out-file>]" ] \end{code} @@ -93,20 +95,26 @@ test :: IO () test = do- putStrLn "============================================================"- putStrLn "Testing the macro environment."- putStrLn "nginx-log-processor"- dumpMacroTable "nginx-log-processor" regexType lp_env- me_ok <- testMacroEnv "nginx-log-processor" regexType lp_env- putStrLn "============================================================"- putStrLn "Testing the log processor on reference data."- putStrLn ""- lp_ok <- test_log_processor- putStrLn "============================================================"- case me_ok && lp_ok of- True -> return ()- False -> exitWith $ ExitFailure 1+ putStrLn "============================================================"+ putStrLn "Testing the macro environment."+ putStrLn "nginx-log-processor"+ is_docs <- doesDirectoryExist "docs"+ when is_docs $+ dumpMacroTable (fp "docs" ".txt") (fp "docs" "-src.txt") regexType lp_env+ dumpMacroTable (fp "data" ".txt") (fp "data" "-src.txt") regexType lp_env+ me_ok <- testMacroEnv "nginx-log-processor" regexType lp_env+ putStrLn "============================================================"+ putStrLn "Testing the log processor on reference data."+ putStrLn ""+ lp_ok <- test_log_processor+ putStrLn "============================================================"+ case me_ok && lp_ok of+ True -> return ()+ False -> exitWith $ ExitFailure 1+ where+ fp dir sfx = dir </> (rty_s ++ "-nginx-log-processor" ++ sfx) + rty_s = map toLower $ presentRegexType regexType test_log_processor :: IO Bool test_log_processor = do
examples/re-prep.lhs view
@@ -176,13 +176,13 @@ pd "re-tests" pd "TestKit" pd "RE/IsRegex"- pd "RE/Replace" pd "RE/REOptions" pd "RE/Tools/Edit" pd "RE/Tools/Grep" pd "RE/Tools/Lex" pd "RE/Tools/Sed" pd "RE/ZeInternals/NamedCaptures"+ pd "RE/ZeInternals/Replace" pd "RE/ZeInternals/TestBench" pd "RE/ZeInternals/Types/Matches" pd "RE/ZeInternals/Types/Match"
examples/re-tests.lhs view
@@ -24,9 +24,11 @@ module Main (main) where import Control.Exception+import Control.Monad import Data.Array import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Lazy.Char8 as LBS+import Data.Char import qualified Data.Foldable as F import qualified Data.HashMap.Strict as HM import Data.Maybe@@ -38,6 +40,8 @@ import Data.Typeable import Language.Haskell.TH.Quote import Prelude.Compat+import System.Directory+import System.FilePath import Test.SmallCheck.Series import Test.Tasty import Test.Tasty.HUnit@@ -105,8 +109,15 @@ where tc rty m_env = testCase (show rty) $ do- dumpMacroTable "macros" rty m_env+ is_docs <- doesDirectoryExist "docs"+ when is_docs $+ dumpMacroTable (fp "docs" ".txt") (fp "docs" "-src.txt") rty m_env+ dumpMacroTable (fp "data" ".txt") (fp "data" "-src.txt") rty m_env assertBool "testMacroEnv" =<< testMacroEnv "prelude" rty m_env+ where+ fp dir sfx = dir </> (rty_s ++ "-macros" ++ sfx)++ rty_s = map toLower $ presentRegexType rty \end{code}
examples/re-tutorial.lhs view
@@ -92,12 +92,12 @@ dealing with bulk text will probably want to choose one of the other options. \begin{code}+import Text.RE.REOptions import Text.RE.Replace import Text.RE.TDFA.String import Text.RE.ZeInternals.Types.Capture import Text.RE.ZeInternals.Types.CaptureID import Text.RE.ZeInternals.Types.Match-import Text.RE.REOptions \end{code} If you are predominantly matching against a single type in your module then you will probably find it more convenient to use the relevant module@@ -315,7 +315,7 @@ Simple REOptions---------------+---------------- By default regular expressions are of the multi-line case-sensitive variety so this query@@ -391,12 +391,12 @@ The `replaceAllCaptures` function is of type -%include "Text/RE/Replace.lhs" "replaceAllCaptures ::"+%include "Text/RE/ZeInternals/Replace.lhs" "replaceAllCaptures ::" and the `REContext` and `RELocation` types are defined in `Text.RE.Replace` as follows, -%include "Text/RE/Replace.lhs" "^data REContext"+%include "Text/RE/ZeInternals/Replace.lhs" "^data REContext" The processing function gets applied to the captures specified by the `REContext`, which can be directed to process `ALL` of the captures,@@ -461,7 +461,7 @@ Compiling REs with the Complete REOptions----------------------------------------+----------------------------------------- Each type of RE — TDFA and PCRE — has it own complile-time options and execution-time options, called in each case `CompOption` and@@ -520,7 +520,7 @@ * `SimpleREOptions` this is just a simple enum type that we use to encode the standard options: -%include "Text/RE/ZeInternals/Types/REOptions.lhs" "^data SimpleREOptions"+%include "Text/RE/REOptions.lhs" "^data SimpleREOptions" * `Mode`: you can specify the parser mode;
lib/cabal-masters/executables-incl.cabal view
@@ -30,7 +30,7 @@ Main-Is: re-nginx-log-processor.lhs -%build-depends-prog regex regex-with-pcre array base base-compat bytestring directory regex-base regex-tdfa shelly text time time-locale-compat transformers unordered-containers+%build-depends-prog regex regex-with-pcre array base base-compat bytestring directory filepath regex-base regex-tdfa shelly text time time-locale-compat transformers unordered-containers %test-exe re-prep Hs-Source-Dirs: examples@@ -50,7 +50,7 @@ Other-Modules: TestKit -%build-depends-prog regex regex-with-pcre array base base-compat bytestring containers directory heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin smallcheck tasty tasty-hunit tasty-smallcheck template-haskell text unordered-containers+%build-depends-prog regex regex-with-pcre array base base-compat bytestring containers directory filepath heredoc regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin smallcheck tasty tasty-hunit tasty-smallcheck template-haskell text unordered-containers %test-exe re-tutorial Hs-Source-Dirs: examples
lib/cabal-masters/library-incl.cabal view
@@ -24,23 +24,14 @@ Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed+ Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PCRE Text.RE.ZeInternals.PreludeMacros- Text.RE.ZeInternals.Replace- Text.RE.ZeInternals.TDFA- Text.RE.ZeInternals.TestBench- Text.RE.ZeInternals.Types.Capture- Text.RE.ZeInternals.Types.CaptureID- Text.RE.ZeInternals.Types.LineNo- Text.RE.ZeInternals.Types.Match- Text.RE.ZeInternals.Types.Matches- Text.RE.ZeInternals.Types.SearchReplace-- Other-Modules: Text.RE.ZeInternals.QQ+ Text.RE.ZeInternals.Replace Text.RE.ZeInternals.SearchReplace Text.RE.ZeInternals.SearchReplace.PCRE Text.RE.ZeInternals.SearchReplace.PCRE.ByteString@@ -56,5 +47,14 @@ Text.RE.ZeInternals.SearchReplace.TDFA.Text Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy Text.RE.ZeInternals.SearchReplace.TDFAEdPrime+ Text.RE.ZeInternals.TDFA+ Text.RE.ZeInternals.TestBench+ Text.RE.ZeInternals.Types.Capture+ Text.RE.ZeInternals.Types.CaptureID+ Text.RE.ZeInternals.Types.LineNo+ Text.RE.ZeInternals.Types.Match+ Text.RE.ZeInternals.Types.Matches+ Text.RE.ZeInternals.Types.SearchReplace+ %build-depends-lib array bytestring base base-compat containers hashable regex-base regex-tdfa regex-tdfa-text regex-pcre-builtin template-haskell text time time-locale-compat transformers unordered-containers
lib/cabal-masters/mega-regex.cabal view
@@ -1,12 +1,13 @@ Name: regex Version: <<$version$>> Synopsis: Toolkit for regex-base-Description: A Regular Expression Toolkit for regex-base with- Compile-time checking of RE syntax, data types for+Description: A regular expression toolkit for regex-base with+ compile-time checking of RE syntax, data types for matches and captures, a text replacement toolkit, portable options, high-level AWK-like tools for building text processing apps, regular expression- macros and test bench, a tutorial and copious examples.+ macros with parsers and test bench, omprehensive+ documentation, tutorials and copious examples. Homepage: http://regex.uk Author: Chris Dornan License: BSD3@@ -15,7 +16,7 @@ Copyright: Chris Dornan 2016-2017 Category: Text Build-type: Simple-Stability: RFC+Stability: Stable bug-reports: http://issues.regex.uk %include "lib/cabal-masters/test-extra-source-files-incl.cabal"
lib/cabal-masters/regex-examples.cabal view
@@ -16,7 +16,7 @@ Copyright: Chris Dornan 2016-2017 Category: Text Build-type: Simple-Stability: RFC+Stability: Stable bug-reports: http://issues.regex.uk %include "lib/cabal-masters/test-extra-source-files-incl.cabal"
lib/cabal-masters/regex.cabal view
@@ -8,6 +8,7 @@ Exposed-Modules: Text.RE Text.RE.IsRegex+ Text.RE.REOptions Text.RE.Replace Text.RE.Summa Text.RE.TDFA@@ -23,23 +24,14 @@ Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed+ Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PreludeMacros+ Text.RE.ZeInternals.QQ Text.RE.ZeInternals.Replace- Text.RE.ZeInternals.TDFA- Text.RE.ZeInternals.TestBench- Text.RE.ZeInternals.Types.Capture- Text.RE.ZeInternals.Types.CaptureID- Text.RE.ZeInternals.Types.LineNo- Text.RE.ZeInternals.Types.Match- Text.RE.ZeInternals.Types.Matches- Text.RE.REOptions Text.RE.ZeInternals.Types.SearchReplace-- Other-Modules:- Text.RE.ZeInternals.QQ Text.RE.ZeInternals.SearchReplace Text.RE.ZeInternals.SearchReplace.TDFA Text.RE.ZeInternals.SearchReplace.TDFA.ByteString@@ -49,6 +41,13 @@ Text.RE.ZeInternals.SearchReplace.TDFA.Text Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy Text.RE.ZeInternals.SearchReplace.TDFAEdPrime+ Text.RE.ZeInternals.TDFA+ Text.RE.ZeInternals.TestBench+ Text.RE.ZeInternals.Types.Capture+ Text.RE.ZeInternals.Types.CaptureID+ Text.RE.ZeInternals.Types.LineNo+ Text.RE.ZeInternals.Types.Match+ Text.RE.ZeInternals.Types.Matches %build-depends-lib array bytestring base base-compat containers hashable regex-base regex-tdfa regex-tdfa-text template-haskell text time time-locale-compat transformers unordered-containers
lib/cabal-masters/test-extra-source-files-incl.cabal view
@@ -9,6 +9,9 @@ data/pp-result-doc.lhs data/pp-result-gen.lhs data/pp-test.lhs+ data/pcre-nginx-log-processor.txt+ data/tdfa-macros.txt+ data/pcre-macros.txt lib/cabal-masters/constraints-incl.cabal lib/cabal-masters/executables-incl.cabal lib/cabal-masters/library-incl.cabal@@ -18,9 +21,6 @@ lib/cabal-masters/test-extra-source-files-incl.cabal lib/mega-regex.cabal lib/version.txt- docs/pcre-nginx-log-processor.txt- docs/tdfa-macros.txt- docs/pcre-macros.txt src/Text/RE/PCRE/ByteString.hs src/Text/RE/PCRE/ByteString/Lazy.hs src/Text/RE/PCRE/Sequence.hs
lib/mega-regex.cabal view
@@ -1,12 +1,13 @@ Name: regex-Version: 0.11.0.0+Version: 0.11.1.0 Synopsis: Toolkit for regex-base-Description: A Regular Expression Toolkit for regex-base with- Compile-time checking of RE syntax, data types for+Description: A regular expression toolkit for regex-base with+ compile-time checking of RE syntax, data types for matches and captures, a text replacement toolkit, portable options, high-level AWK-like tools for building text processing apps, regular expression- macros and test bench, a tutorial and copious examples.+ macros with parsers and test bench, omprehensive+ documentation, tutorials and copious examples. Homepage: http://regex.uk Author: Chris Dornan License: BSD3@@ -15,7 +16,7 @@ Copyright: Chris Dornan 2016-2017 Category: Text Build-type: Simple-Stability: RFC+Stability: Stable bug-reports: http://issues.regex.uk Extra-Source-Files:@@ -29,6 +30,9 @@ data/pp-result-doc.lhs data/pp-result-gen.lhs data/pp-test.lhs+ data/pcre-nginx-log-processor.txt+ data/tdfa-macros.txt+ data/pcre-macros.txt lib/cabal-masters/constraints-incl.cabal lib/cabal-masters/executables-incl.cabal lib/cabal-masters/library-incl.cabal@@ -38,9 +42,6 @@ lib/cabal-masters/test-extra-source-files-incl.cabal lib/mega-regex.cabal lib/version.txt- docs/pcre-nginx-log-processor.txt- docs/tdfa-macros.txt- docs/pcre-macros.txt src/Text/RE/PCRE/ByteString.hs src/Text/RE/PCRE/ByteString/Lazy.hs src/Text/RE/PCRE/Sequence.hs@@ -62,7 +63,7 @@ Source-Repository this Type: git Location: https://github.com/iconnect/regex.git- Tag: 0.11.0.0+ Tag: 0.11.1.0 @@ -92,23 +93,14 @@ Text.RE.Tools.Grep Text.RE.Tools.Lex Text.RE.Tools.Sed+ Text.RE.ZeInternals Text.RE.ZeInternals.AddCaptureNames Text.RE.ZeInternals.EscapeREString Text.RE.ZeInternals.NamedCaptures Text.RE.ZeInternals.PCRE Text.RE.ZeInternals.PreludeMacros- Text.RE.ZeInternals.Replace- Text.RE.ZeInternals.TDFA- Text.RE.ZeInternals.TestBench- Text.RE.ZeInternals.Types.Capture- Text.RE.ZeInternals.Types.CaptureID- Text.RE.ZeInternals.Types.LineNo- Text.RE.ZeInternals.Types.Match- Text.RE.ZeInternals.Types.Matches- Text.RE.ZeInternals.Types.SearchReplace-- Other-Modules: Text.RE.ZeInternals.QQ+ Text.RE.ZeInternals.Replace Text.RE.ZeInternals.SearchReplace Text.RE.ZeInternals.SearchReplace.PCRE Text.RE.ZeInternals.SearchReplace.PCRE.ByteString@@ -124,7 +116,16 @@ Text.RE.ZeInternals.SearchReplace.TDFA.Text Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy Text.RE.ZeInternals.SearchReplace.TDFAEdPrime+ Text.RE.ZeInternals.TDFA+ Text.RE.ZeInternals.TestBench+ Text.RE.ZeInternals.Types.Capture+ Text.RE.ZeInternals.Types.CaptureID+ Text.RE.ZeInternals.Types.LineNo+ Text.RE.ZeInternals.Types.Match+ Text.RE.ZeInternals.Types.Matches+ Text.RE.ZeInternals.Types.SearchReplace + Default-Language: Haskell2010 Other-Extensions:@@ -193,7 +194,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -223,7 +224,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -250,7 +251,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -276,7 +277,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -305,7 +306,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -331,7 +332,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -354,12 +355,13 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0+ , filepath , regex-base >= 0.93.2 , regex-tdfa >= 1.2.0 , shelly >= 1.6.1.2@@ -384,12 +386,13 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0+ , filepath , regex-base >= 0.93.2 , regex-tdfa >= 1.2.0 , shelly >= 1.6.1.2@@ -417,7 +420,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -445,7 +448,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -473,13 +476,14 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , containers >= 0.4 , directory >= 1.2.1.0+ , filepath , heredoc >= 0.2.0.0 , regex-base >= 0.93.2 , regex-pcre-builtin >= 0.94.4.8.8.35@@ -511,13 +515,14 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , containers >= 0.4 , directory >= 1.2.1.0+ , filepath , heredoc >= 0.2.0.0 , regex-base >= 0.93.2 , regex-pcre-builtin >= 0.94.4.8.8.35@@ -550,7 +555,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -594,7 +599,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -640,7 +645,7 @@ -Werror Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0
lib/version.txt view
@@ -1,1 +1,1 @@-0.11.0.0+0.11.1.0
regex-examples.cabal view
@@ -1,5 +1,5 @@ Name: regex-examples-Version: 0.11.0.0+Version: 0.11.1.0 Synopsis: Tutorial, tests and example programs for regex Description: Tutorial, tests and example programs for regex, a Regular Expression Toolkit for regex-base with@@ -16,7 +16,7 @@ Copyright: Chris Dornan 2016-2017 Category: Text Build-type: Simple-Stability: RFC+Stability: Stable bug-reports: http://issues.regex.uk Extra-Source-Files:@@ -30,6 +30,9 @@ data/pp-result-doc.lhs data/pp-result-gen.lhs data/pp-test.lhs+ data/pcre-nginx-log-processor.txt+ data/tdfa-macros.txt+ data/pcre-macros.txt lib/cabal-masters/constraints-incl.cabal lib/cabal-masters/executables-incl.cabal lib/cabal-masters/library-incl.cabal@@ -39,9 +42,6 @@ lib/cabal-masters/test-extra-source-files-incl.cabal lib/mega-regex.cabal lib/version.txt- docs/pcre-nginx-log-processor.txt- docs/tdfa-macros.txt- docs/pcre-macros.txt src/Text/RE/PCRE/ByteString.hs src/Text/RE/PCRE/ByteString/Lazy.hs src/Text/RE/PCRE/Sequence.hs@@ -63,7 +63,7 @@ Source-Repository this Type: git Location: https://github.com/iconnect/regex.git- Tag: 0.11.0.0+ Tag: 0.11.1.0 Executable re-gen-cabals@@ -82,7 +82,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -112,7 +112,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -139,7 +139,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -165,7 +165,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -194,7 +194,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -220,7 +220,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -243,13 +243,14 @@ -Wwarn Build-depends:- regex == 0.11.0.0- , regex-with-pcre == 0.11.0.0+ regex == 0.11.1.0+ , regex-with-pcre == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0+ , filepath , regex-base >= 0.93.2 , regex-tdfa >= 1.2.0 , shelly >= 1.6.1.2@@ -274,13 +275,14 @@ -Wwarn Build-depends:- regex == 0.11.0.0- , regex-with-pcre == 0.11.0.0+ regex == 0.11.1.0+ , regex-with-pcre == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , directory >= 1.2.1.0+ , filepath , regex-base >= 0.93.2 , regex-tdfa >= 1.2.0 , shelly >= 1.6.1.2@@ -308,7 +310,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -336,7 +338,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0@@ -364,14 +366,15 @@ -Wwarn Build-depends:- regex == 0.11.0.0- , regex-with-pcre == 0.11.0.0+ regex == 0.11.1.0+ , regex-with-pcre == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , containers >= 0.4 , directory >= 1.2.1.0+ , filepath , heredoc >= 0.2.0.0 , regex-base >= 0.93.2 , regex-pcre-builtin >= 0.94.4.8.8.35@@ -403,14 +406,15 @@ -Wwarn Build-depends:- regex == 0.11.0.0- , regex-with-pcre == 0.11.0.0+ regex == 0.11.1.0+ , regex-with-pcre == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0 , bytestring >= 0.10.2.0 , containers >= 0.4 , directory >= 1.2.1.0+ , filepath , heredoc >= 0.2.0.0 , regex-base >= 0.93.2 , regex-pcre-builtin >= 0.94.4.8.8.35@@ -443,7 +447,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -487,7 +491,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0@@ -533,7 +537,7 @@ -Wwarn Build-depends:- regex == 0.11.0.0+ regex == 0.11.1.0 , array >= 0.4 , base >= 4 && < 5 , base-compat >= 0.6.0
src/Text/RE/PCRE/ByteString.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.PCRE+ -- $ed , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE as PCRE --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches B.ByteString (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: B.ByteString -> RE -> Match B.ByteString (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/PCRE/ByteString/Lazy.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.PCRE+ -- $ed , module Text.RE.ZeInternals.SearchReplace.PCRE.ByteString.Lazy ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE as PCRE --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches LBS.ByteString (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: LBS.ByteString -> RE -> Match LBS.ByteString (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/PCRE/Sequence.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.PCRE+ -- $ed , module Text.RE.ZeInternals.SearchReplace.PCRE.Sequence ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE as PCRE --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches (S.Seq Char) (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: (S.Seq Char) -> RE -> Match (S.Seq Char) (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char) (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char) (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/PCRE/String.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.PCRE+ -- $ed , module Text.RE.ZeInternals.SearchReplace.PCRE.String ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.PCRE as PCRE --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches String (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: String -> RE -> Match String (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: String -> SearchReplace RE String -> String (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: String -> SearchReplace RE String -> String (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/TDFA/ByteString.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches B.ByteString (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: B.ByteString -> RE -> Match B.ByteString (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: B.ByteString -> SearchReplace RE B.ByteString -> B.ByteString (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/TDFA/ByteString/Lazy.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.ByteString.Lazy ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches LBS.ByteString (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: LBS.ByteString -> RE -> Match LBS.ByteString (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: LBS.ByteString -> SearchReplace RE LBS.ByteString -> LBS.ByteString (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/TDFA/Sequence.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.Sequence ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches (S.Seq Char) (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: (S.Seq Char) -> RE -> Match (S.Seq Char) (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char) (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: (S.Seq Char) -> SearchReplace RE (S.Seq Char) -> (S.Seq Char) (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/TDFA/String.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.String ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches String (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: String -> RE -> Match String (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: String -> SearchReplace RE String -> String (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: String -> SearchReplace RE String -> String (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/TDFA/Text.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.Text ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches T.Text (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: T.Text -> RE -> Match T.Text (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: T.Text -> SearchReplace RE T.Text -> T.Text (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: T.Text -> SearchReplace RE T.Text -> T.Text (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").
src/Text/RE/TDFA/Text/Lazy.hs view
@@ -20,9 +20,6 @@ -- * The 'SearchReplace' Operators , (*=~/) , (?=~/)- -- * The Classic rexex-base match Operators- , (=~)- , (=~~) -- * Matches , Matches , matchesSource@@ -35,16 +32,25 @@ , matchSource , matched , matchedText- -- * The 'RE' Type and Functions+ -- * The 'RE' Type , RE- , SimpleREOptions(..) , reSource+ -- * Options+ -- $options+ , SimpleREOptions(..)+ -- * Compiling and Escaping REs , compileRegex , compileRegexWith , escape , escapeWith , escapeREString+ -- * The Classic rexex-base Match Operators+ , (=~)+ , (=~~)+ -- * The Quasi Quoters and Minor Functions+ -- $re , module Text.RE.ZeInternals.TDFA+ -- $ed , module Text.RE.ZeInternals.SearchReplace.TDFA.Text.Lazy ) where @@ -62,7 +68,8 @@ import qualified Text.Regex.TDFA as TDFA --- | find all matches in text; e.g., to count the number of naturals in s:+-- | find all the matches in the argument text; e.g., to count the number+-- of naturals in s: -- -- @countMatches $ s *=~ [re|[0-9]+|]@ --@@ -71,21 +78,31 @@ -> Matches TL.Text (*=~) bs rex = addCaptureNamesToMatches (reCaptureNames rex) $ match (reRegex rex) bs --- | find first match in text+-- | find the first match in the argument text; e.g., to test if there+-- is a natural number in the input text:+--+-- @matched $ s ?=~ [re|[0-9]+|]@+-- (?=~) :: TL.Text -> RE -> Match TL.Text (?=~) bs rex = addCaptureNamesToMatch (reCaptureNames rex) $ match (reRegex rex) bs --- | search and replace all occurrences; e.g., this section will yield a function to--- convert every a YYYY-MM-DD into a DD/MM/YYYY:+-- | search and replace all matches in the argument text; e.g., this section+-- will convert every YYYY-MM-DD format date in its argument text into a+-- DD\/MM\/YYYY date: ----- @(*=~/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})///${d}/${m}/${y}|])@+-- @(*=~\/ [ed|${y}([0-9]{4})-0*${m}([0-9]{2})-0*${d}([0-9]{2})\/\/\/${d}\/${m}\/${y}|])@ -- (*=~/) :: TL.Text -> SearchReplace RE TL.Text -> TL.Text (*=~/) = flip searchReplaceAll --- | search and replace the first occurrence only+-- | search and replace the first occurrence only (if any) in the input text+-- e.g., to prefix the first string of four hex digits in the imput text,+-- if any, with @0x@:+--+-- @(?=~\/ [ed|[0-9A-Fa-f]{4}\/\/\/0x$0|])+-- (?=~/) :: TL.Text -> SearchReplace RE TL.Text -> TL.Text (?=~/) = flip searchReplaceFirst @@ -120,3 +137,33 @@ -- $tutorial -- We have a regex tutorial at <http://tutorial.regex.uk>.++-- $options+-- You can specify different compilation options by appending a+-- to the name of an [re| ... |] or [ed| ... \/\/\/ ... |] quasi quoter+-- to select the corresponding compilation option. For example, the+-- section,+--+-- @(?=~/ [edBlockInsensitive|foo$\/\/\/bar|])@+--+-- will replace a @foo@ suffix of the argument text, of any+-- capitalisation, with a (lower case) @bar@. If you need to specify the+-- options dynamically, use the @[re_| ... |]@ and @[red_| ... \/\/\/ ... |]@+-- quasi quoters, which generate functions that take an 'IsOption' option+-- (e.g., a 'SimpleReOptions' value) and yields a 'RE' or 'SearchReplace'+-- as apropriate. For example if you have a 'SimpleReOptions' value in+-- @sro@ then+--+-- @(?=~/ [ed_|foo$\/\/\/bar|] sro)@+--+-- will compile the @foo$@ RE according to the value of @sro@. For more+-- on specifying RE options see "Text.RE.REOptions".++-- $re+-- The @[re|.*|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions"), and the+-- specialised back-end types and functions.++-- $ed+-- The @[ed|.*\/\/\/foo|]@ quasi quoters, with variants for specifing different+-- options to the RE compiler (see "Text.RE.REOptions").