Project

General

Profile

Regular Expressions

AdiIRC uses the .NET regular expression engine, while mIRC uses the PCRE engine, some differences are converted from PCRE to .NET while others are not possible.

Exploring ways to use PCRE in .NET is on TODO.

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

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 ($hfind will ignore this).
/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 + > +?, * -> *?)
/u - Enables UTF8 instead of ASCII regular expression.

Differences between .NET and PCRE

AdiIRC translate some patterns from PCRE into .NET patterns.

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

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

These have no .NET counterpart:

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

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

Also available in: PDF HTML TXT