This little code snip, translates a Dynamics NAV regular expression into its .Net equivalent.
public static string NavisionRegToRegex(string strtotest)
{
string navregex = strtotest;
navregex = "(" + navregex + ")$"; // make sure we are testing to the end of the string
navregex = navregex.Replace("*", ".*"); // 0 or more
navregex = navregex.Replace("?", ".{1}"); // single char
// or operator is a |
navregex = navregex.Replace("&", "");
return navregex;
}
Technorati tags:
Dynamics Nav