-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
  • 412,405
  • 93
  • 575
  • 722

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,357
  • 5
  • 40
  • 55
falsetru
  • 357,413
  • 63
  • 732
  • 636