I have the string mysql://user:pw@host/db?reconnect=true
and the following (incorrect) regex: /^mysql:\/\/(.+):(.+)@(.+)\/(.+)\??.*$/
These are the matches I get:
["user", "pw", "host", "db?reconnect=true"]
The only problematic match is "db?reconnect=true"
, which I intend to be "db"
I have tried non-greedy qualifiers for both the "?" after "db" and after the last capturing parenthesis with no success. It seems like the last capturing parenthesis is greedy no matter what. Is there even a solution for this?
Cheers!