unknown1 Posted January 18, 2014 Share Posted January 18, 2014 (edited) How would I go about finding this pattern? some random text http://www.somesite.com/en/bluhbluhbluh/?partner=compare&cy=EN woot 8.99 i tried [A-Za-z][\n]{0,}[http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?]{0,}[\n]{0,}[A-Za-z0-9\.] only this part http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?]{0,}[\n]{0,}[A-Za-z0-9\. is working to find the url but can't get everything else seems like anything i put before or after http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)? does nothing. Need to get "some random text" and "woot 8.99" in addition to the url Edited January 18, 2014 by unknown1 Quote Link to comment Share on other sites More sharing options...
doddsey_65 Posted January 18, 2014 Share Posted January 18, 2014 Haven't tested this but maybe try (.*(?=http))(http:\/\/.*?(?=\s))(.*) Matches everything upto http, then matches http upto first whitespace character, then matches everything after it. Quote Link to comment Share on other sites More sharing options...
unknown1 Posted January 19, 2014 Author Share Posted January 19, 2014 (.*(?=http))(http:\/\/.*?(?=\s))(.*) works however, it doesn't stop after the 8.99 like it should. Quote Link to comment Share on other sites More sharing options...
doddsey_65 Posted January 19, 2014 Share Posted January 19, 2014 Wasn't aware you wanted it to stop. Will it always end in 8.99 or can the string change? Quote Link to comment Share on other sites More sharing options...
unknown1 Posted January 19, 2014 Author Share Posted January 19, 2014 it's always a number with the 8.99 format Quote Link to comment Share on other sites More sharing options...
doddsey_65 Posted January 20, 2014 Share Posted January 20, 2014 Sorry for the late reply. If you haven't sorted it yet you could use my example with a small change at the end (.*(?=http))(http:\/\/.*?(?=\s))(.*?)\d\.\d 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.