Aamir
Aamir

Reputation: 326

PHP Regex Dealing With Parenthesis

As far as i understand regex tries to match everything mentioned in brackets

eg.

<b>(.*)</b>

Inside a larger regular expressions how do u differentiate between this and the braces mentioned in the regular expression to be matched.

(hello),(how)

in the above example we need to match brackets, but if the reg exp itself has paranthesis [as in first example] then how will it be differentiated?

Thanks

Upvotes: 0

Views: 47

Answers (1)

merlin2011
merlin2011

Reputation: 75555

If you want to match literal (), then you need to escape them in most regex engines, like this: \(, \).

Upvotes: 2

Related Questions