Jump to content

Find String Between Two Strings...


markvaughn2006

Recommended Posts

...exampleleftside=thedataIwant">examplerightside

 

 

How would one go about capturing the data I want from some html code similar to the one above? I know how and would be using file_get_contents, running a while loop, putting the captured data in a variable, and storing it to a database, I'm just not getting regex...

 

Any help would be greatly appreciated, thanks!

Link to comment
https://forums.phpfreaks.com/topic/271469-find-string-between-two-strings/
Share on other sites

From the very limited example you've given, which I'm not sure will be enough:

$RegExp = '/=([^"]+)/';

That'll find an equals sign, then match and capture everything that is not a double quote, up to the first double quote it finds. (Then it's not not a quote any more, after all.)

From the very limited example you've given, which I'm not sure will be enough:

$RegExp = '/=([^"]+)/';

That'll find an equals sign, then match and capture everything that is not a double quote, up to the first double quote it finds. (Then it's not not a quote any more, after all.)

 

Anyway to make it find everything after the exampleleftside= up until the first double quote?? Thanks for the help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.