GingerRobot Posted June 30, 2008 Share Posted June 30, 2008 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted July 1, 2008 Share Posted July 1, 2008 mysql regexp simply returns a boolean -- there's a UDF at mysqludf.org that has a more useful regexp egine. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 1, 2008 Author Share Posted July 1, 2008 Fair enough. I thought that was the case, but i thought i'd check. Wrote some php to do what i needed, but thanks for the suggestion for anything in the future. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.