Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:14:03+00:00 2026-06-06T00:14:03+00:00

I have some MP3 files that are named with a particular syntax, for example:

  • 0

I have some MP3 files that are named with a particular syntax, for example:

1 – Sebastian Ingrosso – Calling (Feat. Ryan Tedder)

I have written a small program in C# that reads the Track, Artist and Title from the ID3 tags. What i would like to do is write a regex expression that can validate that the files are in fact named with the syntax listed above.

So i have a class called song:

 //Properties
public string Filename
{
    get { return _filename;  }
    set { _filename = value; }
}

public string Title
{
    get { return _title;  }
    set { _title = value; }
}

public string Artist
{
    get { return _artist;  }
    set { _artist = value; }
}


//Methods

public bool Parse(string strfile)
{
    bool CheckFile;

    Tags.ID3.ID3v1 Song = new Tags.ID3.ID3v1(strfile, true);
    Filename = Song.FileName;
    Title = Song.Title;
    Artist = Song.Artist;


    //Check File Name Formatting
    string RegexBuilder = @"\d\s-\s" + Artist + @"\s-\s" + Title;
    if (Regex.IsMatch(Filename, RegexBuilder))
    {
        CheckFile = true;
    }
    else
    {
        CheckFile = false;
    }
    return CheckFile;
 }

So it works, MOST OF THE TIME. The minute i have a (Feat. ) in the title it fails. The closest i could come up with is:

\d\s-\s\Artist\s-\s.*

That’s obviously not going to work as any text would pass the test, I have tried my very best but I have only been programming for two weeks.


tl;dr Would like song to pass a regex test whether it contains a featured artist or not, for example:

1 – Sebastian Ingrosso – Calling (Feat. Ryan Tedder)

and

1 – Flo Rida – Whistle

Should both pass the test.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:14:05+00:00Added an answer on June 6, 2026 at 12:14 am

    The problem is that the “(” and “)” in your regex have meaning to the Regex engine. You should use the following code:

    string RegexBuilder = @"\d\s-\s" + Regex.Escape(Artist) + @"\s-\s" + Regex.Escape(Title);
    

    The Escape function will change “(Feat. )” to “\(Feat. \)”, which will ensure that you are matching the parentheses and not grouping “Feat. “.

    http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.escape.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that contains some links to .mp3/.wav files in that format
I have some files, sound files (.wav and .mp3) and text files (.rtf), in
(Problem solved, please see the updates) I have some files that have incorrect filenames
I'm now doing some work with decoding MP3 files, but just have some basic
I have a VideoView that is playing back some .mp4 files from sdcard. The
I have a Native WinApi C++ Application that finds media(.wmv, .mp3 etc.) files in
I have a problem with forcing download of some mp3/zip files. The problem is
I have some values that are stored with core data, and I have opened
I have some animation that was created in the main timeline in an FLA
I have some sentences that I want to parse. Here is what I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.