Project

General

Profile

Scripting Regex » History » Version 15

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

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