Jump to content

grep


sandy1028

Recommended Posts

From what I know, you'll probably want to loop through $data and use preg_match or preg_match all.

 

I think this RegExp should work: Results(.*?)seconds

 

Edit: not sure if there are spaces between Results and seconds. You probably want to include spaces. But again, you haven't told me much.

 

Also, http://www.phpfreaks.com/forums/index.php/topic,250066.0.html.

 

That's your other topic. Same thing. You can use the same RegExp for this with a few changes.

Link to comment
Share on other sites

<p> Results <b>1</b> - <b>10</b> of about <b>87,800,000</b> for <b>aaa</b> [<a href="/url?q=http://www.answers.com/aaa&r=67&ei=VCn5ScLKCtWGkAWmmM2LCg&sa=X&oi=dict&ct=d&usg=AFQjCNHhNb5eNJ7HxcW4GRMeBmfbiYe5cw"
title="Look up definition of aaa">definition</a>]<b></b>.  (<b>0.08</b> seconds) </div><div id=res class=med><!--a--><h2 class=hd>Search Results</h2><div><ol><!--m--><link rel="prefetch" href="http://www.aaa.com/"><li class=g><h3 class=r>
<a href="http://www.aaa.com/" class=l onmousedown="return clk(this.href,'','','res','1','')"><em>AAA</em> - 

 

How to extract only the string between Results and from seconds and delete the other characters.

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.