owl
owl

Reputation: 4481

Get inside data between tags (regexp)

How I can get all data between tags?

My RegExp: \<table id\=\"listtable\".+\>(.*)\<\/table\>

result:

enter image description here

I think it because there are line breaks. How to fix it?

Thanks in advance.

Upvotes: 1

Views: 69

Answers (1)

anubhava
anubhava

Reputation: 786091

To make it match across multiple lines you can use this regex:

/<table id="listtable"[\s\S]*>([\s\S]*)<\/table>/ig

Use of [\s\S]* instead of .* makes it match it across new lines.

Upvotes: 1

Related Questions