View Single Post
  #11  
Old Feb 23, 2009, 06:52 PM
PhantomSnake PhantomSnake is offline
Junior Member
 
Join Date: Feb 2009
Location: Canada
Posts: 21
Default

I figure I might as well release the full source code for Let's Tag, right?

Here you go:
Let's Tag 0.1 Source
Edit: The latest source can be found here.

I tried to clean up the regexes a bit. I also slapped on a GPL license just for the heck of it.

For those who just want the regexes, here they are, straight from the code:

Code:
        readonly static Regex albumNameRegex = new Regex(
            @"<span\s+class\s*=\s*" + "[\\\'\\\"]albumtitle[\\\'\\\"]" + @"\s+lang\s*=\s*" + "[\\\'\\\"]en[\\\'\\\"]" + @".*?>(.*?)</span>",
            RegexOptions.Singleline | RegexOptions.IgnoreCase);

        readonly static Regex detailRegex = new Regex(
            @"<tr>.*?<td.*?>.*?<span\s+class\s*=\s*" + "[\\\'\\\"]label[\\\'\\\"]" + @".*?>\s*<b>(.*?)</b>\s*</span>.*?</td>" +
            @".*?<td.*?>(.*?)</td>.*?</tr>",
            RegexOptions.Singleline | RegexOptions.IgnoreCase);

        readonly static Regex detailCatalogNumberRegex = new Regex(
            @"<span\s+id\s*\=\s*" + "[\\\'\\\"]childbrowse[\\\'\\\"]" + @".*?" +
            @"<a\s+.*?>(.*?)</a>",
            RegexOptions.Singleline | RegexOptions.IgnoreCase);

        readonly static Regex detailMultilingualValueRegex = new Regex(
            @"<span\s+.*?lang\s*\=\s*" + "[\\\'\\\"](.*?)[\\\'\\\"]" + @".*?>(.*?)</span>",
            RegexOptions.Singleline | RegexOptions.IgnoreCase);

        readonly static Regex detailValueCleanupRegex = new Regex(
            @"<.*?>",
            RegexOptions.Singleline | RegexOptions.IgnoreCase);

        readonly static Regex discRegex = new Regex(
            @"<b>\s*Disc\s+(\d+)\s*</b>.*?<table.*?>(.*?)</table>",
            RegexOptions.Singleline | RegexOptions.IgnoreCase);

        readonly static Regex trackRegex = new Regex(
            @"<span\s+class\s*=\s*" + "[\\\'\\\"]label[\\\'\\\"]" + @"\s*>(.*?)</span>" + // Track number
            @".*?<td.*?>(.*?)</td>", // Track name
            RegexOptions.Singleline | RegexOptions.IgnoreCase);
It's best to look at the code to figure out how these regexes are used. Also, I'm no regex wizard, so I apologize if any of it is confusing.

I'm focusing on a different project right now. I'll probably get back to this in a little while. I hope you guys can make some use of the source in the meantime!

Last edited by PhantomSnake; May 11, 2009 at 07:19 PM.
Reply With Quote