Project

General

Profile

Scripting Regex » History » Version 7

Per Amundsen, 04/27/2015 05:50 PM

1 1 Per Amundsen
{{>toc}}
2
3
h1. Regular Expressions
4
5 2 Per Amundsen
(*UTF8) - Enables utf8 instead of ascii regular expression.
6 1 Per Amundsen
7
h1. Modifiers
8
9
/g /G - Enables global match.
10
/i /I - Enables Case in-sensitive.
11
/S - Strips any control codes before matching. 
12
/s - Enables single line match.
13
/m /M /c /C - Enables multi line match.
14
/x /X - Eliminates unescaped white space from the pattern.
15
/U - Enabled non greedy mode. (Tries to replace greedy patterns with non greedy patterns + > +?, * -> *?)
16
17
h1. Differences between .NET and prce
18
19
AdiIRC translate some patterns from PRCE into .NET patterns.
20
21 6 Per Amundsen
<notextile>(?R) -> .*</notextile>
22
<notextile>(?2) -> .*</notextile>
23
<notextile>(?1) -> .*</notextile>
24 4 Per Amundsen
<notextile>++ -> +</notextile>
25 5 Per Amundsen
<notextile>[:alnum:] -> a-zA-Z0-9</notextile>
26
<notextile>[:alpha:] -> a-zA-Z</notextile>
27
<notextile>[:ascii:] -> \x00-\x7F</notextile>
28
<notextile>[:blank:] -> \s\t</notextile>
29
<notextile>[:cntrl:] -> \x00-\x1F\x7F</notextile>
30
<notextile>[:digit:] -> 0-9</notextile>
31
<notextile>[:graph:] -> \x21-\x7E</notextile>
32
<notextile>[:lower:] -> a-z</notextile>
33
<notextile>[:print:] -> \x20-\x7E</notextile>
34
<notextile>[:punct:] -> !"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~</notextile>
35
<notextile>[:space:] -> \s\t\r\n\v\f</notextile>
36
<notextile>[:upper:] -> A-Z</notextile>
37
<notextile>[:word:] - > A-Za-z0-9_"</notextile>
38
<notextile>[:xdigit:] -> A-Fa-f0-9</notextile>
39
<notextile>\cc -> \x003</notextile>
40
<notextile>\co -> \x00F</notextile>
41
<notextile>\cb -> \x002</notextile>
42
<notextile>\x\{([A-Fa-f0-9]{1,4})\} -> \uXXXX</notextile>
43 7 Per Amundsen
<notextile>\E \Q escapes all characters in between</notextile>
44 1 Per Amundsen
45
\K is not available in .NET, use (<=abc)d instead.
46
47
These are not available and have no .NET counterpart:
48
code (?{…})
49
recursive (R), (R1), (R&name) (?R)
50
define (DEFINE).
51
52
List of differences between .NET and PRCE https://stackoverflow.com/questions/3417644/translate-perl-regular-expressions-to-net