Remove last few characters from string

Feb 3, 2011 at 9:45pm

Remove last few characters from string

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. –
#38717
Feb 3, 2011 at 11:17pm

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

#135215
Feb 4, 2011 at 1:27am

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

– Pasted Max Patch, click to expand. –
#135216
Feb 6, 2011 at 10:54am

Thanks guys, you always come up with a solution!

#135217

You must be logged in to reply to this topic.