Forums > MaxMSP

parsing, regexp HELP!

November 27, 2011 | 5:14 pm

i have hit a massive wall with my patch, basically what i would like to do is have max download pictures from a website and display them. I have got to the point where i have the website code downloaded, and i can find lines of code that have .jpg in them ( this is using regexp ). I now need to
extract the url from these lines so i can send the message on to the downloader.

the kind of messages i am working with are :

&lt p&gt &lt a href=&quot http://www.flickr.com/photos/library_of_congress/6056606287/&quot title=&quot Photographer Carol M. Highsmith joins Sharon Tyson and visiting children as they interact with a colorful artistic illusion screen at the ArtWorks exhibit in the Museum of Fine Art Montgomery Alabama (LOC)&quot &gt &lt img src=&quot http://farm7.staticflickr.com/6183/6056606287_c3d3741afc_m.jpg&quot width=&quot 240&quot height=&quot 162&quot alt=&quot Photographer Carol M. Highsmith joins Sharon Tyson and visiting children as they interact with a colorful artistic illusion screen at the ArtWorks exhibit in the Museum of Fine Art Montgomery Alabama (LOC)&quot /&gt &lt /a&gt &lt /p&gt

something like this, however they are not all the same length, so simple list slicing doesnt work. I tried understand how regexp works but its so different from what im used to, there must be some way of telling it to look for a http and a jpg and output everything in between aswell

as soon as this is worked out i can carry on and finsh my patch!


November 27, 2011 | 5:43 pm

If you reply with the URL that you are downloading the HTML from I will take a look and see if I can put together an expression that will work for you.


November 27, 2011 | 5:46 pm

OK so this post was definitely in frustration, a cup of tea cleared my head, i read the helpfile and finally understood

the answer to my question answered by me is

regexp http[^>\s*]+jpg

from what i understand this looks for a http, then checks to see if white spaces appear anywhere and then looks for a jpg and chucks everything out

:D happy days


November 27, 2011 | 6:02 pm

Luke – the url i am using to test is

http://flickr.com/services/feeds/photoset.gne?set=72157626966535635&nsid=8623220@N02&lang=en-us

when the patch is finished i will upload it so you can have a look, thank you for your offer though it is much appreciated


Viewing 4 posts - 1 through 4 (of 4 total)