I don’t know anything about regular expressions but I think I have to use it for my probleme I got some filenames that look like :
MyResource
MyResource.en-GB
MyResource.en-US
MyResource.fr-FR
MyResource.de-DE
The idea is to test if my strings end with “[letter][letter]-[letter][letter]”
I know this is a very noob, but I just have no idea about how to do it, even if I know exactly what I wanna do… 🙁
That would be testing your input against:
This is really very literal: “match a dot (
\., the dot being a special character in regexes), followed by exactly two of any characters fromatoz([a-z]{2}—[...]is a character class), followed by a dash (-), followed by two of any characters fromAtoZ([A-Z]{2}), followed by the end of input ($).http://www.dotnetperls.com/regex-match <– how to apply this regex in C# against an input. It means the code would look like (UNTESTED):
http://regex.info <– buy that and read it, it is the BEST resource for regular expressions in the universe
http://regular-expressions.info <– the second best resource