0
votes

I am parsing one file using flex/bison and I want to know how to identify same consecutive line.

 Example:

BEGIN BLOCK BLK1    

BEGIN BLOCK BLK_ROWDEC

How can I write regular expression to identify this two line that starting with BEGIN.

I have tried

^BEGIN(.*)\r?\n^BEGIN(.*)

But it is not identifying my string.

Please help me to parse this string.

1
Try /^BEGIN\b(.*)\r?\n\s*^BEGIN\b(.*)/m. - Wiktor Stribiżew
"lex.l", line 45: unknown error processing section 1 "lex.l", line 95: fatal parse error It gives error - shailavi shah

1 Answers

0
votes

The below regex will identify these two lines.

^BEGIN(.*)\r?\n+\s*BEGIN(.*)