Jump to content

[SOLVED] Selecting a part of a string with regular expressions


GingerRobot

Recommended Posts

Just wondered if it is possible to retrieve the actual matching part of a regular expression in MySQL?

 

I know that you can use REGEXP in the WHERE clause to find rows matching a particular pattern, but i've been unable to find anything showing that you can use a regular expression in the SELECT clause to be able to show the part of the string which matches the regular expression.

 

If that's still not clear, perhaps explaining what i'm trying to do would help better. Basically, i'm trying to update my Amarok music library. Though it provides support for .wma tracks, it seems it doesn't read the track data correctly, so doesn't know the track number. However, the track number is stored in the filename so i'm trying to update the track number from that. The path to track might be: ./home/ben/Music/The Killers/Hot Fuss [uK]/10 Midnight Show.wma -- i'm trying to grab the 10 in this case.

 

If anyone has any suggestions, i'd be glad to hear them.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.