I have to match a text which should be able to match a pattern in JavaScript. The pattern should be able to match if there is any text which starts with opening square bracket "[" but doesn't end with "]".
Look at the below example:
This is a [Sample text-> This should return me[Sample textThis is [again] a [sample text-> This should also return me[sample text
I have tried multiple ways like below:
\[([^\]]+)\.*[^}]$
And
\[([^\]]+)\.*[^}]$
But both of them are not working as expected. I am not very good in Regex patterns hence seeking a help here.
Thanks