Regex for retrieving date format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msjonathan
    New Member
    • Dec 2009
    • 24

    Regex for retrieving date format

    hej hej,

    I can't succeed to produce a piece of code that does the following: If I have a string with a file name =>
    Code:
    nameOfFile{yyyy/mm/dd}.txt it becomes nameOfFile2010/06/28.txt
    It should be also possible for multiple dates
    Code:
    nameOfFile{yyyy/mm/dd}inMonth{mm/yyyy/dd}
    I tried to write a regex expression to retrieve the format from filename.
    Code:
    string[] dateFormats = Regex.Split(fileName, @"(\{.\})*");
    but this does not work :( has anybody some experience with this?
Working...