I am fairly new to using regex and I am not entirely clear on the syntax for everything yet. Basically I am stuck on a bit of code where I have:
if(@"\d{2,}\s"+string == Path.GetFileNameWithoutExtension(dir))
{
do stuff
}
My problem is that it won't match anything. I basically have a bunch of files that it's searching through that all have 2 digits and a space, then the name that the user is searching for. Can I combine regex + string like that or is the problem with my regex/statement? Just for clarity, it will match when I actually remove the two digits and space from the files. I apologize if the problem is obvious, I've only been playing with regex for a few days...
\d{2,}\sand the content ofstringinto a single string - what you call a "regex" would be simply a literal string. Instead of trying to hack a regex into things (which isn't always appropriate), why not explain what you're trying to accomplish and ask how to to so?\d{3}piewill match any three digits and the word pie.