On 1/4/2015 5:42 AM, Reindl Harald wrote:

Am 04.01.2015 um 06:43 schrieb Bob Proulx:
The additional issue was that you were referencing PHP documentation.
Might as well have been referencing Lisp documentation for all of the
relevance it had. That was the point I saw being addressed at that
point. PHP is a similar syntax that came after Perl but it very much
is its own thing and Perl does not derive from it

we are talking about PCRE and the PHP function preg_quote() to escape a string for *perl* regular expressions not the language syntax and since the backneds are alreay there i just asked *what* chars *additional* to that function needs to be escaped *besides* the @ i found out myself

that is a short and simple question and not refer to the used PHP function would not have been hepful at all


Ok. Here is an attempt at a simple answer off the top of my head. (Not guaranteed to be complete)

The following characters may need to be escaped in a Perl regex (as used in SA) if intended to be used as literal characters:

$%@/[{*+?\

] and } may need to be escaped as well, but I don't think it is required.

You can avoid having to escape the slash (/) by using a different separator for the regex. This can avoid "leaning toothpick syndrome."

For example:
   m#http://match/this/url/#
instead of
   /http:\/\/match\/this\/url\//

Note that whatever character you use will then need to be escaped if used within the regex.

--
Bowie

Reply via email to