0

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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

3 Comments

Can u explain by writing a regular expression for the example in my question?? ( which can b used by preg_match In php)
@Aamir, What exactly are you trying to capture? The stuff between the literal parenthesis? Including the literal parenthesis, or not including the literal parenthesis?
tried out a few regular expressions and i understood now ... thanks for ur help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.