-3

I have this fiddle I'm trying to get the html inside the <app> tag, but can't seem to get it working. How can I fix it? The regex I am using is .match(/<app.*>(.*?)<\/app>/)[1];

williamsandonz
  • 13,581
  • 21
  • 88
  • 171

1 Answers1

1

That's because . matches everything except for newlines, but you want to match everything. Use [\s\S] instead. Check it here: https://jsfiddle.net/vumcgger/

Also, never parse html with regex (unless you really need to): RegEx match open tags except XHTML self-contained tags

Ethan
  • 4,165
  • 4
  • 22
  • 41