0

I'm trying to match a character constant. I only want single characters and a few escape sequences rather than \ followed by any letter.

This is very similar to this question with the added requirement of specific escape characters. Regular expression to match escaped characters (quotes)

'(\\\[tvrnafb\\\]|.)'
Community
  • 1
  • 1
AlexLordThorsen
  • 8,057
  • 5
  • 48
  • 103

1 Answers1

3

I feel dumb, I just had to remove the period in the other answer and add another character class.

'(\\[tvrnafb\\]|[^\\'])'
AlexLordThorsen
  • 8,057
  • 5
  • 48
  • 103