extract a number from a message
Hi guys,
Pulling my hair out trying to work out how to do something that I assume there is a simple answer to, so I'm throwing it out there to you.
Does anyone know how to extract a number from a message?
I'm using a umenu which is pointed to a folder with audio samples to load samples into a buffer. What I want to do is put a number after the file name that I can extract whenever the file is loaded. This number will tell my patch how many bars long the sample is. So for example introguitar4.wav is sent to an object which looks at this message sees that there is a number 4, when it does it sends the number, or a bang, or whatever out of an outlet.
I've looked at the zl object, which would do the job perfectly accept for the fact that I have to label the files in a particular way to get it to see the numbers. So if the file is named introguitar 4 .wav it works fine, it sees the four and sends a bang out of the left outlet. The problem is that when using umenu, if there are spaces in the file name, for some reason it puts brackets around the text, which causes the zl object not to see the number.
Thank's for any help you may be able to offer...
regexp can do that:
Ask if the regexp help is not enough for understanding.
Ad.
Thanks Ad. I haven't had a chance to look at how it works yet, but it works.