Regex with optional characters at the end of the String that need to be excluded but can be present at any place

Viewed 21

I have the following regex:

^(?<value>.+)"?:?$

I need to match stuff like ABC": or ABC or ABC: or ABC, the thing is with the current regex the " or : are included in the group when matched, then I tried ^(?<value>[":]+)\"?:?$ but that won't work if I have them in the middle of the String: A:B or ABC"D:

How I can exclude those two characters only when they are at the end of the String

0 Answers
Related