Stephen K
Stephen K

Reputation: 737

Match until the next line starts

I'm using simple HTML dom to get the source of a web page. Then I'm using dom->innerhtml to get the text. I want to match a line that says var api_response = {...}; however I am having trouble with it continuing to go until the end of the document.

My current regex is /var api\_response.+\}\;/

Any ideas?

Upvotes: 0

Views: 58

Answers (1)

shA.t
shA.t

Reputation: 16968

I think you can use a regex like this:

 /var api_response = \{[^}]+\};/ig

or

/var api_response\s*=\s*\{[^}]+\};/ig

Upvotes: 1

Related Questions