Seems to me that you should be doing:
import re
print(re.sub('class', 'function', 'Class object', flags=re.I))
Without this, the re.I
argument is passed to the count
argument.
More Related Contents:
- Regular expression doesn't produce expected result
- How t extract last part of a text in python [duplicate]
- Python extract pattern matches
- Split a string by spaces — preserving quoted substrings — in Python
- Does “\d” in regex mean a digit?
- Remove all special characters, punctuation and spaces from string
- How to filter rows in pandas by regex
- Use Python’s string.replace vs re.sub
- Natural sorting
- Python regular expression re.match, why this code does not work? [duplicate]
- matching any character including newlines in a Python regex subexpression, not globally
- Python, remove all non-alphabet chars from string
- How do I return a string from a regex match in python? [duplicate]
- Splitting a string with repeated characters into a list
- How to combine multiple regex into single one in python?
- ip address validation in python using regex [duplicate]
- “Nothing to repeat” from Python regex
- Mass string replace in python?
- python-re: How do I match an alpha character
- Unexpected NoReverseMatch error when using include() in urls patterns
- How to do CamelCase split in python
- Extract the ‘src’ attribute from an ‘img’ tag using Beautiful Soup
- Regular expression to return all characters between two special characters
- Matching only a unicode letter in Python re
- Problem with regexp python and sqlite
- How to use str.contains() with multiple expressions in pandas dataframes
- match dates using python regular expressions
- How to Fix JSON Key Values without double-quotes?
- python regular expression across multiple lines
- How to use regex with optional characters in python?