Extract one line from "jit.str.regexp"

Sammio2's icon

Hi there guys,

Max Patch
Copy patch and select New From Clipboard in Max.

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!

1503.TwitterSynth.maxpat
Max Patch
Ben Bracken's icon

Edit->Copy Compressed

Sammio2's icon

Thanks, amended!

MIB's icon
Max Patch
Copy patch and select New From Clipboard in Max.

one way:

Sammio2's icon

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

Thanks for your help so quickly!

Ben Bracken's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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

-Ben

MIB's icon

regexp gives me headaches!! ;)

Sammio2's icon

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

paba7's icon

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

Sammio2's icon

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

bt.soundmaker's icon

Did you find a way to do it Sammi02?
I am trying this also and I can't figure out, Is it something to do with the gate ? If I print from gate I can see its all there, but I don't know how to get all of it, in the message box it just displays the last line..