Either start or not a "d"
-
I try to get the date number format from a date format string. The date number format is - if present - either a single d or a double d. But the whole string can contain a place holder for the dayname also - ddd or dddd. How can I get the d or dd, if present? I tried
[^d](?<pattern>d{1,2})[^d]
which works well with the standard German format (dddd, d. MMMM yyyy
). But that fails when the daynumber comes first (say:d. dddd MMMM yyyy
; here,^(?<pattern>d{1,2})[^d]
does the trick), and it fails when the daynumber comes last. Actually I need something like a "either start of the string or not a d", i.e.^|[^d]
- but that does not work. How can that be solved? -
I try to get the date number format from a date format string. The date number format is - if present - either a single d or a double d. But the whole string can contain a place holder for the dayname also - ddd or dddd. How can I get the d or dd, if present? I tried
[^d](?<pattern>d{1,2})[^d]
which works well with the standard German format (dddd, d. MMMM yyyy
). But that fails when the daynumber comes first (say:d. dddd MMMM yyyy
; here,^(?<pattern>d{1,2})[^d]
does the trick), and it fails when the daynumber comes last. Actually I need something like a "either start of the string or not a d", i.e.^|[^d]
- but that does not work. How can that be solved?Solved it with
@"\b(?d{1,2})\b"