0

I was looking for a good formal structure for strings in a language, but I can't find one. The EBNF for C just has a class called string, and from python it has a const STRING as far as I've seen. So I was wondering if anyone had a good EBNF or regex that matches only valid strings within quotes. So it would match this: "Hello\nWorld!" but not this: "Hello\World!" since \W is not a control sequence.

Hovestar
  • 1,544
  • 4
  • 18
  • 26
  • 1
    Since different languages have different string literals you should probably specify the language if you want a regex string literal's for that language. – John Coleman May 28 '17 at 22:35
  • 1
    If I recall correctly, strings in False match the regex `"[^"]*"`. – melpomene May 28 '17 at 22:40

0 Answers0