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