0

I want to non-greedily match a string that don't contain ,, :, and #c, and I have tried this:

((,|。|,|:|#c)@!){-}

which doesn't work.

How can I make it work?

  • 2
    Based on your stated definition, you want to match one-character strings that are not ,:。. This is because a) lazy matching doesn't go beyond one character if the only condition is not to contain something and b) because a one-character string cannot contain #c, which is two characters, so you can just as well forget about that condition. This is easy to achieve: [^,:。] However, I suspect that what you are actually after is slightly different. Maybe you could flesh out that definition a bit, including one or two examples. – Endre Both Dec 14 '18 at 10:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.