Am 05.01.2015 um 23:14 schrieb Bowie Bailey:
On 1/5/2015 5:02 PM, Reindl Harald wrote:Am 05.01.2015 um 22:57 schrieb Bowie Bailey:On 1/5/2015 4:13 PM, John Hardin wrote:For example: m#http://match/this/url/#Ouch. # won't work for that (in SA at least) as it comments out the rest of the RE.Ack! Forgot about that minor difference with SA. # is my general go-to character for that in normal Perl scripts. This should illustrate the same point with the minor improvement of actually *working* in SA: m^http://match/this/url/^i would not play such games because it makes it even more likely that a common escape function is missing something, besides that header CUST_MANY_SPAM_TO X-Local-Envelope-To =~ /^(\<h\.reindl\@thelounge\.net\>)$/iIt is mainly useful for creating a regex to match a URI without needing to escape every slash in the string. Trying to sort out something like: /http:\/\/domain\.com\/xxx\/blah\/blah\// gets old fast. So you pick a character that you don't need in the regex and use it as a separator character instead so you don't need nearly as many escapes.
agreed but normally one would use a common escape function and that becomes complicated if you have to escape different chars here and there
Now that I think about it, there is at least one other character that needs escaping in a regex: the pipe symbol |
well, that's luckily covered, i only did not expect that i need to handle @ % and # manually especially because @ does not need to be escaped for grep or postfix-pcre rules
[harry@srv-rhsoft:~]$ php -r "echo preg_quote('|');" \|
signature.asc
Description: OpenPGP digital signature