My regex is as following:
\[(((".*?")|([a-z][\w]*|[^0-9a-z,\[\]A-Z\s]+|'(.*?)')|([+-]?[0-9]+)|([+-]?(\.[0-9]+|[0-9]\.[0-9]*|[0-9]\.))|([+-]?([0-9]*?\.[0-9]+|[0-9]+)[Ee][+-]?[0-9]+)|([A-Z][\w]*)|(\4\((\1|\2|\3|\4|\5|\6|\7|\8|\9|\10|\11|\12)*)\))((\s)|\s*|(, ?\1))?)*[^, ]+\]
The objective of that regex is to find wether a 'list' exists or not. list may contain: empty list( [], numbers, 'methods, in which you can pass arguments', symbols, strings between simple quotes, variables, etc...pretty much anything).
And it must match the following test cases: (commas not included)
[], [hola, 23, "Alfa"], [A,b,c(x), d]
I got it working on regexr.com which as i understand uses js regex, however when converting regex to java, it cant identify the same test cases. any clues as to why this is happening?
\\[(((\".*?\")|([a-z][\\w]*|[^0-9a-z,\\[A-Z\\s]+|'(.*?)')|([+-]?[0-9]+)|([+-]?(\\.[0-9]+|[0-9]\\.[0-9]*|[0-9]\\.))|([+-]?([0-9]*?\\.[0-9]+|[0-9]+)[Ee][+-]?[0-9]+)|([A-Z][\\w]*)|(\\4\\((\\1|\\2|\\3|\\4|\\5|\\6|\\7|\\8|\\9|\\10|\\11|\\12)*)\\))((,\\s)|\\s?))*\\]
java transformed regex ↑ (quotation from beginning and end excluded)
im using jflex as a tool to build a lexical analyzer