Extract one line from "jit.str.regexp"

Dec 7, 2010 at 7:00pm

Extract one line from "jit.str.regexp"

Hi there guys,

This is my first post, I have done some searching around and just cannot seem to get this patch working as I want. I’m sure it’s painfully simple, but i just can’t figure out how to do it. Essentially, i’m loading an XML file into a jit.textfile, then running a query for everything within tags. It’s working perfectly well, but it prints out all 20 results, ideally, i just want the first result. If anyone can help me, i’d be so grateful!

– Pasted Max Patch, click to expand. –
#53764
Dec 7, 2010 at 7:05pm

Edit->Copy Compressed

#193387
Dec 7, 2010 at 7:09pm

Thanks, amended!

#193388
Dec 7, 2010 at 7:25pm

one way:

– Pasted Max Patch, click to expand. –
#193389
Dec 7, 2010 at 7:35pm

Brilliant, That’s pretty much exactly what I need.

Thanks for your help so quickly!

#193390
Dec 7, 2010 at 8:37pm

You should be able to do this all in regexp. Something like this might do it too:

– Pasted Max Patch, click to expand. –

-Ben

#193391
Dec 7, 2010 at 11:28pm

regexp gives me headaches!! ;)

#193392
Dec 8, 2010 at 12:46pm

Thanks for your help guys, both methods seem to work. I have to say for now I agree with MIB, It’s giving me a headache, but I may have to look into it further at a later point in my project,

These forums are awesomely useful!

Thanks again!

Sam

#193393
Dec 11, 2010 at 12:28am

Hi Sam,

Could post the fixed patch? I am fairly new to max and not advanced enough to figure out the code posted here. I am a student trying to use weather xml data to match it up to sound. A basic example for pulling in xml data will be helpful.

Thanks,
Paba

#193394
Feb 2, 2011 at 9:34pm

Hi all,

Paba7: See Bens patch above (Copy the code, then in max create new from clipboard)

Ben: Is there any way to configure the regexp object to not output the final ‘‘ as it appears on the end of every string. Been racking my brains about this for ages!

Many Thanks

Sam

#193395

You must be logged in to reply to this topic.