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
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.)

Link to comment
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.)

 

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.