Forums > MaxMSP

Remove last few characters from string

February 3, 2011 | 9:45 pm

Hi all,

Posted for help a while ago, on the same thing, but a different issue. Basically, i’m using the ‘regexp’ object to extract one line from an XML file, but for some reason the extraction includes the last set of brackets, i.e. .

Can anyone have a look at this, and see if there’s an easy way to extract just the information within the brackets?

If anyone can help, i’d be very grateful!

Sam

– Pasted Max Patch, click to expand. –

February 3, 2011 | 11:17 pm

I’m actually not quite sure how to only get one backreference with regexp, but you could use one of many patching workarounds like this:

– Pasted Max Patch, click to expand. –

-Ben


February 4, 2011 | 1:27 am

You can use lazy quantifiers in regexp so you only select the part from flags.

– Pasted Max Patch, click to expand. –

February 6, 2011 | 10:54 am

Thanks guys, you always come up with a solution!


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