-2

I have a simple regex I'm using and that works perfectly in chrome but edge throws a syntax error, ths is the line :

var html=text.match(/^<div.+\/div>$/ims);

I don't see the problem.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Entretoize
  • 2,124
  • 3
  • 23
  • 44

2 Answers2

0

Because /s flag is not supported, use:

var html=text.match(/^<div[\s\S]+\/div>$/im);
Toto
  • 89,455
  • 62
  • 89
  • 125
0

Basically you want to match all characters with a new line character You can this regex please:-

text.match(/^<div>.+\n*.*<\/div>/)
prashantsahni
  • 2,128
  • 19
  • 20