ho questa regex \[.+\]\(.+\)
Regex due caratteri speciali di fila
Perché si abbinano questa stringa del tutto?
[test1](test1) thisbitshouldnotmatch [test2](test2)
Deve corrispondere solo [test1](test1)
e [test2](test2)
. thisbitshouldnotmatch
non dovrebbe corrispondere.
Cosa ti fa pensare che debba corrispondere solo a 'test1' e' test2'? –
Scusa, ho formulato la domanda meglio. Penso che le cose tra la seconda parentesi quadra e la prima parentesi tonda non dovrebbero corrispondere. – James
* Off topic *: Se il tuo regex flavor supporta pattern ricorsivi '(? R)' puoi provare quanto segue '(?: \ [(?: [^ [\]] | (? R)) * \] | \ ((?: [^()] | (? R)) * \)) ', questo potrebbe anche corrispondere a stringhe come' [test1 [test11]] (test1 (test11)) '[demo] (http: // regex101 .com/r/uP7kE2). – HamZa