storing regex strings in resx files? RRS feed

  • Question

  • User1183903743 posted
    Hi I have lots of validation regex patterns which differ by culture. Limiting user input by alphabet, punctuation rules, phone numbers, postal codes etc. The code is much cleaner if I could extract those into a resx file instead of messy switch statements or helper classes. Are all the UTF-8, UTF-16 characters supported directly into the resx or do they have to be encoded or escaped? On the other hand a pre-compiled assembly all these patterns is also nice. How can I get the best of both worlds? TIA Rob
    Monday, February 21, 2005 4:39 PM

All replies

  • User-125436819 posted
    Hey Rob, U can't just use every character in resx files. I haven't used a lot of regex /s characters in resxes, but a simple thing like > can't be used. Now, since regexes are difficult as they are, it;s probably better to do this in a seperate class. In a class u can also use the currentculture.decimalseparator / thousandseparator and dynamically load the datformat. Hope it helps, Owin
    Monday, February 28, 2005 11:07 AM