This documentation is archived and is not being maintained.

Example: Changing Date Formats

The following code example uses the Regex::Replace method to replace dates that have the form mm/dd/yy with dates that have the form dd-mm-yy.

No code example is currently available or this language may not be supported.

The following code shows how the MDYToDMY method can be called in an application.

No code example is currently available or this language may not be supported.

The regular expression pattern \b(?<month>\d{1,2})/(?<day>\d{1,2})/(?<year>\d{2,4})\b is interpreted as shown in the following table.

Pattern

Description

\b

Begin the match at a word boundary.

(?<month>\d{1,2})

Match one or two decimal digits. This is the month captured group.

/

Match the slash mark.

(?<day>\d{1,2})

Match one or two decimal digits. This is the day captured group.

/

Match the slash mark.

(?<year>\d{2,4})

Match from two to four decimal digits. This is the year captured group.

\b

End the match at a word boundary.

The pattern ${day}-${month}-${year} defines the replacement string as shown in the following table.

Pattern

Description

$(day)

Add the string captured by the day capturing group.

-

Add a hyphen.

$(month)

Add the string captured by the month capturing group.

-

Add a hyphen.

$(year)

Add the string captured by the year capturing group.

Show: