views:

110

answers:

3

Should i add some character/s before or after < character (which is in string i'm trying to extract something from - it's html page) when doing preg match?

+1  A: 

you dont need to escape < unless you are saving a user generated data and then you should be concerned about security and XSS.

Mohammad
thanks for the down vote :) I guess that's what I should expect for answering such questions!
Mohammad
There appear to be some people here who are down vote trigger happy. Luckily a few up votes erases the damage from a down ;)
Daniel Bingham
true that. :) cheers.
Mohammad
+6  A: 

you don't need to escape it, it's not a special character in regexes.

SilentGhost
+2  A: 

Some regex parsers treat the "<" and ">" symbols as the word boundaries (GNU Basic & Extended regular expressions). See this great site for all regex-related info.

Yurik