tags:

views:

57

answers:

2

I am working on an email filter and I have come across a list of regular expressions that are used to block all emails coming from senders that match a record in that list. While browsing through the list, I have discovered that all occurrences of the @ character are escaped with a \.

Does the @ mean anything special in regular expressions and needs to be escaped like so \@?

+3  A: 

It's normally not a special character, but it doesn't hurt to escape it which is probably why many people do it, they just want to be safe (or they think it's a special character).

dcp
A: 

No, the @ is not special character in regex.

The the \ can be use in this meaning

Pattern: \Q...\E

Def Matches the characters between \Q and \E literally, suppressing the meaning of special characters.

Example: \Q+-/\E matches +-/

Vash