NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Example: Changing Date Formats

The following example uses the Regex.Replace method to replace dates of the form mm/dd/yy with dates of the form dd-mm-yy.

String MDYToDMY(String input) {
   return Regex.Replace(input, "\b(?<month>\d{1,2})/(?<day>\d{1,2})  
      /(?<year>\d{2,4})\b",null, "${day}-${month}-${year}");
}

Regex Replacement Pattern

This example shows the use of named backreferences within the replacement pattern for Regex.Replace. For example, the replacement expression ${day} inserts the substring captured by the group (?<day>…).

The Regex.Replace function is one of several static functions provided so that regular expression operations can be done without creating an explicit regular expression object. This is convenient when a compiled regular expression is not going to be kept.