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