Hello,
Am Samstag, 10. August 2013 schrieb Tanstaafl:
> I was adding a string to my $noreply regex, and noticed something
> (don't know why I didn't notice it before)...
>
> Some of the expressions being tested are escaping the hyphen (-), and
> some aren't.
>
> The ones that are are from the original strings that were being tested
> against:
>
> ...|owner\-|\-(owner|request|bounces)|request\-|...
>
> Does the hyphen in these strings need to be escaped? I have about 6
> others that are not...
Both ways work. Escaping - is superfluous, but it doesn't hurt ;-)
The only special case is inside [...] - but there, escaping with \ won't
work, it has to be the first or last character:
[a-z] searches for a, b, c, ..,.y, z
[az-] searches for a, z or -
[-az] same as [az-]
Regards,
Christian Boltz
--
> > wenn Du auch unbedingt eines der größten Rätsel
> > der Informatik benutzen mußt...
> Ich weiß gar nicht, was du gegen den vi(m) hast,
nichts wirksames, von :q! mal abgesehen...
[Hajo Pflueger und Christopher Splinter in dag°]
|