Jump to content

[SOLVED] PREG_match help


briant

Recommended Posts

These regular expressions are so hard to understand. Anyone know of a really good tutorial?

 

My problem is this.

 

$content = "<h2>hi</h2> 123 (cats)<br> 456 (dogs)<br> 789 (fishes)";

 

I want to be able to match 456 because of dogs. Usually I can do it if the pattern is before but since this is after, how can I do it?

 

PS: This is for content I have no control over, so I can't change the content.

Link to comment
Share on other sites

Oh sorry, I should have looked through the other forums.

 

Thank you for your help. I will try that out and let you know.

 

I will try to read the tutorial as well.

 

If it doesn't work out, I think I will just do a strstr function to get what I want.

 

Thanks for your assistance.

Link to comment
Share on other sites

It worked, thanks so much.

 

My example was kind of stupid since the numbers 456 should've been anything including letters.

 

But I'll figure it out. Thanks for your example gevans. You've been more than helpful.

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.