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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.