-1

I'm trying to match this text in JavaScript:

HEADER
abc1234 blah blah
FOOTER

Using

(?s)HEADER.*?\w{3}\d{4}[\w ]+.*?FOOTER

But it isn't matching.

Any ideas why?

Bohemian
  • 389,931
  • 88
  • 552
  • 692

1 Answers1

2

(?s) (DOTALL flag) is not recognized in Javascript regular expression.

Workaround for that I use is using [\s\S] instead of . to match any character including newlines.

/HEADER[\s\S]*?\w{3}\d{4}[\w ]+[\s\S]*?FOOTER/

enter image description here

Rakesh KR
  • 6,207
  • 5
  • 41
  • 51
falsetru
  • 336,967
  • 57
  • 673
  • 597