Wednesday, July 04, 2007

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:
Wednesday, July 04, 2007 9:15:53 PM UTC  #    Comments [0]  | 
Comments are closed.

Theme design by Jelle Druyts

Pick a theme: