I am familiar with Regular Expressions, but this complex example is tripping me up. I trying to understand what this line of code is doing:
r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)'
It is a code snippet that is trying to detect a regular expression, for example: /\s+/. I understand it until the nested [, \[, and the ( counterparts.
(I need to port this code from Python to Java and am having problems understanding how the above works, and why it does not work as is in Java.)
Here’s an exploded version that might help: