cosmicsea Posted February 1, 2010 Share Posted February 1, 2010 im trying to use this code right here to crawl for some links /example\.com\/(.*)/ but the problem is it is leaving out the "/" after .com. lets say the link format for example is example.com/435345/details.html the code works fine and will grab that link but it grabs it as example.com435345/details.html what can i do to make the "/" be there after .com? can anyone help with this? Thanks Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted February 1, 2010 Share Posted February 1, 2010 /example\.com(\/.*)/ Quote Link to comment Share on other sites More sharing options...
cosmicsea Posted February 1, 2010 Author Share Posted February 1, 2010 /example\.com(\/.*)/ Hey thank you very much. I appreciate it. That works great! Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted February 1, 2010 Share Posted February 1, 2010 No problem Quote Link to comment Share on other sites More sharing options...
cosmicsea Posted February 1, 2010 Author Share Posted February 1, 2010 I have 2 more problems i just ran into if someone could help me. on this one im trying to grab "Hp" but there is a huge gap as you can see so what would i do to fill that white space gap and grab "Hp". <div class="dk_first"> Hp<span> here is what im trying. "/dk\_first\"\>.*?(.*)\<\/span/" in this example, the word "example" can be any line of text and that bit of code there is what i have to work with so how would i grab that 7.6 MB? family2 c">info example (7.6 MB)</p> i know this is wrong but here is what i have been messing with "/family2 c\"\>info .?* \(([\d+\.]{0,12} [A-Za-z]{2})MB)<\/p\>/" can anyone help me with any of these please? thanks. Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted February 1, 2010 Share Posted February 1, 2010 /dk\_first\"\>.*?(.*)\<\/span/m /family2 c\"\>info .*? \(([\d+\.]{0,12} [A-Za-z]{2})MB)<\/p\>/ Try those Quote Link to comment Share on other sites More sharing options...
cosmicsea Posted February 1, 2010 Author Share Posted February 1, 2010 /dk\_first\"\>.*?(.*)\<\/span/m /family2 c\"\>info .*? \(([\d+\.]{0,12} [A-Za-z]{2})MB)<\/p\>/ Try those they both dont seem to work. this one /dk\_first\"\>.*?(.*)\<\/span/m will work if i backspace this text in the test html file to meet like so but with the way it is spaced it will not work. im not sure what to do. <div class="dk_first">Hp<span> Quote Link to comment Share on other sites More sharing options...
cosmicsea Posted February 1, 2010 Author Share Posted February 1, 2010 I think i just need to know how to do this when there is 2 lines involved or white space. Is there anything that i could do to define where white space or the next line etc would be? Quote Link to comment Share on other sites More sharing options...
cosmicsea Posted February 1, 2010 Author Share Posted February 1, 2010 $content = str_replace("\n", '',$content); preg_match('/dk\_first\"\>(.*)\<\/span/',$content,$matches); I got this one to work like this but now i get the text i need but with all the html following. how can i end this regex after it grabs text? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.