python > Python3 regex replace

Testing python3 regex replace


Image on regexpress/python


  • * string regex
    Regular Expression.
  • string replace
    Replace string.
  • boolean IGNORECASE
    Perform case-insensitive matching; expressions like [A-Z] will match lowercase letters, too.
  • boolean LOCALE
    Make \w, \W, \b, \B, \s and \S dependent on the current locale.
  • boolean MULTILINE
    When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline); and the pattern character '$' matches at the end of the string and at the end of each line (immediately preceding each newline). By default, '^' matches only at the beginning of the string, and '$' only at the end of the string and immediately before the newline (if any) at the end of the string.
  • boolean DOTALL
    Make the '.' special character match any character at all, including a newline; without this flag, '.' will match anything except a newline.
  • boolean ASCII
    Make \w, \W, \b, \B, \d, \D, \s and \S perform ASCII-only matching instead of full Unicode matching.
  • boolean VERBOSE
    This flag allows you to write regular expressions that look nicer and are more readable by allowing you to visually separate logical sections of the pattern and add comments. Whitespace within the pattern is ignored, except when in a character class or when preceded by an unescaped backslash. When a line contains a # that is not in a character class and is not preceded by an unescaped backslash, all characters from the leftmost such # through the end of the line are ignored.