Extracting data from filename (help me optimize this small chunk of code)

    Jul 07 2012 | 4:39 pm
    Rather than using some fancy msp ways to detect the bpm of some of my loops, I chose to include the exact bpm in the filename and now I am extracting it when I load the file to my buffer. However, I am wondering if there's a way to do it with less objects.
    I know the bpm is written in the 5th, 6th and 7th character from the right, so after converting my filename into a list, I revert it and select these 3 characters. If the filename has no bpm, these characters won't be number so in the end I get 0, I will make sure receiving a 0 there will turn off the bpm sync.
    So yeah, I think this patch works fine but I am wondering if I could make it shorter / more efficient.

    • Jul 07 2012 | 5:53 pm
      This is incredible. I see that you find the underscore and the .wav and just output what's inbetween.
      I gotta learn how to do that haha! thanks.. I'll get started with regexp!