Regex for Matching First Alphanumeric Character skipping (The |An? )

Posted by TheLizardKing on Stack Overflow See other posts from Stack Overflow or by TheLizardKing
Published on 2010-04-10T20:48:43Z Indexed on 2010/04/10 20:53 UTC
Read the original article Hit count: 284

Filed under:
|
|

I have a list of artists, albums and tracks that I want to sort using the first letter of their respective name. The issue arrives when I want to ignore "The ", "A ", "An " and other various non-alphanumeric characters (Talking to you "Weird Al" Yankovic and [dialog]). Django has a nice start '^(An?|The) +' but I want to ignore those and a few others of my choice.

I am doing this in Django, using a MySQL db with utf8_bin collation.

© Stack Overflow or respective owner

Related posts about python

Related posts about mysql