Regular expressions RRS feed

  • Question

  • Hi,

    I need a regular expression that allows only below characters 

    A-Z upper case
    a-z lower case (if there is anything lower case, conver to upper case)


    carriage return and new line feed (\r and \n)

    Thank You

    Friday, August 31, 2018 3:19 PM


  • Use Regex Editor Lite (VS Extension) or similar tool to help you create regular expressions. Note that REs aren't always the best solution. In an RE letters and digits are represented as \w. The remainder of the characters are listed as is with special characters (parens, brackets, etc) needing to be delimited. For example the following would match identifiers (starts with letter and is followed by zero or more letters, digits or underscores).

    Setting the RegexOptions to IgnoreCase will cause case to not matter. You'll have to explicitly convert lower case characters to upper (String.ToUpper) if you want that in the results. RE doesn't modify stuff.

    Michael Taylor

    Friday, August 31, 2018 5:07 PM