I need to develop a parser which should match something like
text a=5 " a=20";
text a=..."
a=20";
3 text a=..."
a=20
b=34
c=12
";
I have used this regular expression in my Lex file to generate the tokens:
\".\s*.*\s.\"
which matches " followed by anything and a newline etc.
The problem with the above regular expression is that it can take at most 2 new line(\n) characters because the . fails to match (\n) and breaks at that point. so i had to explicitly specify (\s*) to match the newline in between quotes(" "). if my file contains something as:
text a=10 "
b=25
c=30
d= 40
e=11
";
the above regular expression(\".\s*.*\s.\") fails to match it.
Can anyone write the regular expression which can take any any number of new lines inside the quotes (" ") and which will help to solve my problem
But when i use the regular expression
\"(.|[ \t\v\n])*\"I get a fatal error as "input buffer overflow, can't enlarge buffer because scanner uses REJECT"
I see now that your original string is correct. But you don't need the first *. The * after the parenthesis takes care of it. The reason it works is because of |. It means either the first character range or the second character range. Really, it's redundant: you should be able to put everything into one set of brackets.