Project

General

Profile

Scripting Regex » History » Revision 26

Revision 25 (Per Amundsen, 04/27/2015 06:05 PM) → Revision 26/60 (Per Amundsen, 08/09/2015 05:41 AM)

{{>toc}} 

 h1. Regular Expressions 

 Read more about .NET regular expressions: 

 http://regexhero.net/reference/ 
 https://msdn.microsoft.com/en-us/library/hs600312%28v=vs.110%29.aspx 
 https://msdn.microsoft.com/en-us/library/az24scfc%28v=vs.110%29.aspx 
 http://www.regular-expressions.info/dotnet.html 

 h1. Modifiers 

 .NET does not use a /pattern/modifier syntax, but AdiIRC tries to interpret it and remove them from the pattern. 
 
 /g /G - Enables global match. 
 /i /I - Enables case in-sensitive. 
 /S - Strips any control codes before matching.  
 /s - Enables single line match. 
 /m /M /c /C - Enables multi line match. 
 /x /X - Eliminates unescaped white space from the pattern. 
 /U - Enables non greedy mode. (Tries to replace greedy patterns with non greedy patterns + > +?, * -> *?) 

 h1. Differences between .NET and PRCE 

 AdiIRC translate some patterns from PRCE into .NET patterns. 

 <notextile>(*UTF8) -> Enables utf8 instead of "ASCII":http://www.asciitable.com/ ascii regular expression.</notextile> 
 <notextile>(?R) -> .*</notextile> 
 <notextile>(?2) -> .*</notextile> 
 <notextile>(?1) -> .*</notextile> 
 <notextile>++ -> +</notextile> 
 <notextile>[:alnum:] -> a-zA-Z0-9</notextile> 
 <notextile>[:alpha:] -> a-zA-Z</notextile> 
 <notextile>[:ascii:] -> \x00-\x7F</notextile> 
 <notextile>[:blank:] -> \s\t</notextile> 
 <notextile>[:cntrl:] -> \x00-\x1F\x7F</notextile> 
 <notextile>[:digit:] -> 0-9</notextile> 
 <notextile>[:graph:] -> \x21-\x7E</notextile> 
 <notextile>[:lower:] -> a-z</notextile> 
 <notextile>[:print:] -> \x20-\x7E</notextile> 
 <notextile>[:punct:] -> !"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~</notextile> 
 <notextile>[:space:] -> \s\t\r\n\v\f</notextile> 
 <notextile>[:upper:] -> A-Z</notextile> 
 <notextile>[:word:] - > A-Za-z0-9_</notextile> 
 <notextile>[:xdigit:] -> A-Fa-f0-9</notextile> 
 <notextile>\cc -> \x003</notextile> 
 <notextile>\co -> \x00F</notextile> 
 <notextile>\cb -> \x002</notextile> 
 <notextile>\x\{([A-Fa-f0-9]{1,4})\} -> \uXXXX</notextile> 
 <notextile>\Q \E tries to escapes all characters in between</notextile> 

 \K is not available in .NET, use (<=abc)d instead. 

 These are not available and have no .NET counterpart: 

 code (?{…}) 
 recursive (R), (R1), (R&name) 
 define (DEFINE). 

 List of differences between .NET and PRCE https://stackoverflow.com/questions/3417644/translate-perl-regular-expressions-to-net