could you help out , i am am receiving an email and trying to extract the link from the text so that the match would be [https://development-client.test.app/users/reset-password?email=test.test%40inbox.testmail.app&code=98f192b1-5673-45b5-b498-d55a4ba3345]
I need to ignore the brackets and stop once code= value ends
This would match all the way including the bracket https:\/\/[^\s]+
Use
\[([^\]]+)\]
to find your match in capture group #1.
Not sure if this is your intention, if I understood you correctly then this option would work for matching any text in between a starting "[" and a closing "]":
const text =
'[https://development-client.test.app/users/reset-password?email=test.test%40inbox.testmail.app&code=98f192b1-5673-45b5-b498-d55a4ba3345]';
console.log(text.match(/(?<=^\[).*(?=\]$)/)[0]);
// https://development-client.test.app/users/reset-password?email=test.test%40inbox.testmail.app&code=98f192b1-5673-45b5-b498-d55a4ba3345
You should exclude the closing (escaped) bracket together with the whitespaces:
https:\/\/[^\s^\]]+
You can check it here.