Dan wrote:
> I built individual escaped and non escaped body tests for every non
> letter/number symbol on my keyboard and threw an email with every
> symbol in it, at them. This was the result:
>
>
> works with and without /
> ! " $ % & ' , - : ; < = > @ ] _ ` { } ~
>
>
> works only with /
> # ( ) * + . / ? [ \ ^ |
>
>
> The surprise is that {}'s and ()'s are each in one group while []'s
> are split between left and right. Does this look correct?
>
First, I assume you mean they work with \ not /. / won't escape things,
\ will.

Also, your test results are not quite the same as the perl regex docs,
but close.

>From the "Perl Regular Expression Quick Reference 1.05"
------------
The following 12 characters need to be escaped
with a backslash - “\” - because by default,
they mean something special.

\ | ( ) [ { ^ $ * + ? .
-----------
Re-ordered to most closely match your second list:

( )*+ . ? [ \ ^ | { $

Now, the differences:

# is in your list, but not in the above list. Presumably this is SA's
rule parser treating it as a comment charachter.

/ is in your list, but not in the above. Actually, whether / needs
escaping or not depends on what delimiter you use for your regex. The
default is /, but you can use the match operator to change it (usually
only used for uri rules so all the / don't need to be escaped in
http://foo.com/this/that/something.html)

I don't understand why $ would work without escaping. It definitely will
NOT work at the end of a regex without escaping, or in regexes with the
/s modifier. However, perhaps your version perl is smart enough to
realize your $ in the middle of a single-line regex is a mistake and
assumes you meant \$.

I also don't understand why { worked for you without escaping, unless
perl made another assumption. You definitely can't match {2} without
escaping.





Reply via email to