Question

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

Was it helpful?

Solution

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

OTHER TIPS

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top