Scripting Regex » History » Version 16
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 | 6 | Per Amundsen | <notextile>(?R) -> .*</notextile> |
28 | <notextile>(?2) -> .*</notextile> |
||
29 | <notextile>(?1) -> .*</notextile> |
||
30 | 4 | Per Amundsen | <notextile>++ -> +</notextile> |
31 | 5 | Per Amundsen | <notextile>[:alnum:] -> a-zA-Z0-9</notextile> |
32 | <notextile>[:alpha:] -> a-zA-Z</notextile> |
||
33 | <notextile>[:ascii:] -> \x00-\x7F</notextile> |
||
34 | <notextile>[:blank:] -> \s\t</notextile> |
||
35 | <notextile>[:cntrl:] -> \x00-\x1F\x7F</notextile> |
||
36 | <notextile>[:digit:] -> 0-9</notextile> |
||
37 | <notextile>[:graph:] -> \x21-\x7E</notextile> |
||
38 | <notextile>[:lower:] -> a-z</notextile> |
||
39 | <notextile>[:print:] -> \x20-\x7E</notextile> |
||
40 | <notextile>[:punct:] -> !"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~</notextile> |
||
41 | <notextile>[:space:] -> \s\t\r\n\v\f</notextile> |
||
42 | <notextile>[:upper:] -> A-Z</notextile> |
||
43 | 8 | Per Amundsen | <notextile>[:word:] - > A-Za-z0-9_</notextile> |
44 | 5 | Per Amundsen | <notextile>[:xdigit:] -> A-Fa-f0-9</notextile> |
45 | <notextile>\cc -> \x003</notextile> |
||
46 | <notextile>\co -> \x00F</notextile> |
||
47 | <notextile>\cb -> \x002</notextile> |
||
48 | <notextile>\x\{([A-Fa-f0-9]{1,4})\} -> \uXXXX</notextile> |
||
49 | 7 | Per Amundsen | <notextile>\E \Q escapes all characters in between</notextile> |
50 | 1 | Per Amundsen | |
51 | \K is not available in .NET, use (<=abc)d instead. |
||
52 | |||
53 | These are not available and have no .NET counterpart: |
||
54 | 13 | Per Amundsen | |
55 | 1 | Per Amundsen | code (?{…}) |
56 | 11 | Per Amundsen | recursive (R), (R1), (R&name), (?R) |
57 | 1 | Per Amundsen | define (DEFINE). |
58 | |||
59 | List of differences between .NET and PRCE https://stackoverflow.com/questions/3417644/translate-perl-regular-expressions-to-net |