Originally Posted By: Nillen
Explaining how regular expressions work is outside the scope of this forum. There's too much to say about it that it can't be done in here.
You can read up on regular expressions at these sites:
http://www.regular-expressions.info/
http://en.wikichip.org/wiki/mirc/regex

Thanks for the information, I will come to read.


Originally Posted By: Wims
\Q \E is a sequence which allow you to escape whatever is inside this sequence, in this example it is used to escape the dot '.', the forward slash '/' and the '?' question mark, a backward slash could have been used to escape these: /youtube\.com\/watch\?v=(\w+)$/

the /g modifier allows you to multiple match at once, that's why you get 2 in your cat|dog example, if you don't use /g, once one match has been found (cat), nothing else is processed and the function would return 1.

Thanks for the explanation, it was very helpful.