user1482261
user1482261

Reputation: 191

Preg_match jquery script

I want to get "bla bla bla" from this string

jQuery('#showcasecities').html("bla bla bla");

I've tried

preg_match_all("/jQuery(\'#showcasecities\').html(\"([^`]*?)\");/", $string, $matches);

no luck =( please help!

Upvotes: 0

Views: 768

Answers (2)

Abu Romaïssae
Abu Romaïssae

Reputation: 3911

Try this:

preg_match_all("#jQuery\('\#showcasecities'\)\.html\((.*)\)#",$string,$matches);

Upvotes: 1

David Landes
David Landes

Reputation: 398

You need to escape the parenthesis. Instead, try this

preg_match_all("/jQuery\(\'#showcasecities\'\).html\((\"(.*?)\")\);/", $string, $matches);

Upvotes: 1

Related Questions