Reputation: 15109
I have a string that might terminate with multiple )
characters and possibly followed by some non-character symbols (,.:;
etc)
I'm testing with this string this is foo bar)),:
and this regex -> \){1}\W*?$
but this matches both )
. How can I match only the last )
(no matter how many are there) ?
Upvotes: 1
Views: 79
Reputation: 785156
this regex ->
\){1}\W*?$
but this matches both)
. How can I match only the last)
.
You can use negated character class:
\)[^\w)]*$
[^\w)]
will match anything but a )
or any word char.
Upvotes: 1