What is a regex “independent capturing group”?

Tags: regex java
Question!

From the Java 6 Pattern documentation:

Special constructs (non-capturing)

(?:X)   X, as a non-capturing group

(?>X)   X, as an independent, non-capturing group

Between (?:X) and (?>X) what is the difference? What does the independent mean in this context?



Answers

(?>X[?/*/+]) is the same as (?:X)[?/*/+]+.



(?>X)[?/*/+] is the same as (?:X)[?/*/+]+.

By : jobard


This video can help you solving your question :)
By: admin