Parsing Text

Alexi's icon

Hi,

I've got a problem that to my mind should be kind simply to fix but after hours of searching can't find anything.

Basically, my patch reads ID3 Tag data from an XML file, and splits it into individual lines that read like:

The Beatles
Revolver
Taxman</>

etc...

Is there anyway to get rid of the & parts. I've tried to do this with [sprintf] and [regexp] but am having no luck as MaxMSP reads it as one word.

Failing that is there a way it can be converted into numbers, something like unicode. As it's use eventually will be to query a database.

Any tips would be great, cheers.

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

regexp should do the trick:

Not sure if it is of interest to you, but Jeremy Bernstein made a nice object for reading id3 tags, metatag:

-Ben

Alexi's icon

Cheers Ben, that's exactly what I wanted, just hadn't got round to learning the regexp syntax.

Will also check out Jeremy Bernstein's object, looks very relevant to my project.

Ben Bracken's icon

Yeah, its a bit of a beast.

As far as learning the regexp syntax, here are a few useful ref links:

There are some nifty tutorials out there too. I remember reading through this one and finding it useful:

-Ben

Amil Mille's icon

there's also tap.xml.sax from Electrotap's Tap.Tools objects, which saves having to learn any regexp and also maintains structure...