For eg:
I have wildcard pattern to find UK format dates
Wildcard pattern : [0-9]{1,2}[dhnrst]{2} <[AFJMNSOD]*> [0-9]{4} // this pattern will find the UK format date "7th August 2001"
Out put also will find the UK format dates, but out put should be in regex format as follows.
\b[0-9]{1,2}[th|rd]+\s[\w]+\s[0-9]{4}\b // this regex pattern also will find the UK date format "7th August 2001"
Please suggest me how to bring this output using c#. (Except string find and replacement method)


VulpesRank #55 · 29.2K reputationPosted Jun 15, 2014, 9:00 AM EDT
A similar approach could be used to map a regular expression to an MS wildcard expression provided the former doesn't include any features which can't be represented in the latter such as alternation, optional characters, look-ahead, look-behind etc.
VulpesRank #55 · 29.2K reputationPosted Jun 10, 2014, 2:57 AM EDT
However, as I'm sure you know, these patterns are far from perfect and it would be possible to come up with a more accurate regular expression if that were needed.
Khan Abrar AhmedRank #778 · 3K reputationPosted Jun 10, 2014, 3:04 AM EDT
http://stackoverflow.com/questions/5899794/match-and-replace
http://stackoverflow.com/questions/6005609/replace-only-some-groups-with-regex
http://stackoverflow.com/questions/474335/using-regex-to-edit-a-string-in-c-sharp
Penikton Bernard37 reputationPosted Jun 10, 2014, 3:10 AM EDT
Thanks a lot for looking my post, The input string should be a pattern its either regex or wildcard Its should not be the normal text
VulpesRank #55 · 29.2K reputationPosted Jun 10, 2014, 2:06 PM EDT
The only problem it has is that it will always validate February 29th even if it's not a leap year.
If you don't want matches to be case insensitive, then just remove the (?i) from the regular expression.
The output is:
Penikton Bernard37 reputationPosted Jun 11, 2014, 2:14 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 12, 2014, 1:49 AM EDT
You can write the whole lot as a single string if you like.
The reason why I say this is more comprehensive than the wildcard pattern is that the latter would validate something like: 0dn Application 0000 as a valid UK format date.
So you really need something better than this.
Penikton Bernard37 reputationPosted Jun 12, 2014, 3:58 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 12, 2014, 4:25 AM EDT
Do you have a link to documentation on the wildcard pattern or is the above example all you have to work from?
Penikton Bernard37 reputationPosted Jun 12, 2014, 4:37 AM EDT
Penikton Bernard37 reputationPosted Jun 12, 2014, 4:39 AM EDT
Penikton Bernard37 reputationPosted Jun 16, 2014, 6:00 AM EDT