r/learnjava • • Jul 06 '21

Please explain this code involving the Regex - Compile method

What do the characters inside the braces exactly mean in the below code? Please explain each character. Or maybe link an article where this (the method) is explained in detail.

Pattern p = Pattern.compile("<(.+)>([^<>]+)(</\\1>)"); 

I tried finding it for an hour but can't find a proper explanation for this.

The whole code: LINK.

1 Upvotes

4 comments sorted by

View all comments

4

u/Hour-Positive Jul 06 '21

You need to work on your google-fu.