Pass re.IGNORECASE
to the flags
param of search
, match
, or sub
:
re.search('test', 'TeSt', re.IGNORECASE)
re.match('test', 'TeSt', re.IGNORECASE)
re.sub('test', 'xxxx', 'Testing', flags=re.IGNORECASE)
More Related Contents:
- Searching for IP addresses in a file
- How to understand regular expression with python?
- Escaping regex string
- Fast punctuation removal with pandas
- Python regex matching Unicode properties
- Python: How to match nested parentheses with regex?
- How do you validate a URL with a regular expression in Python?
- Match text between two strings with regular expression
- Regex to extract URLs from href attribute in HTML with Python [duplicate]
- How to replace only part of the match with python re.sub
- How to split by commas that are not within parentheses?
- Replace first occurrence of string in Python
- BeautifulSoup webscraping find_all( ): finding exact match
- In Python, how to check if a string only contains certain characters?
- Case Insensitive Flask-SQLAlchemy Query
- How to handle response encoding from urllib.request.urlopen() , to avoid TypeError: can’t use a string pattern on a bytes-like object
- Regex: AttributeError: ‘NoneType’ object has no attribute ‘groups’
- remove unicode emoji using re in python
- Python – RegEx for splitting text into sentences (sentence-tokenizing) [duplicate]
- Python regex string matching?
- Re.match() returns always none
- How to use regular expression in lxml xpath?
- replacing only single instances of a character with python regexp
- Why isn’t the regular expression’s “non-capturing” group working?
- Python Regular Expression Match All 5 Digit Numbers but None Larger
- Python regular expression for HTML parsing
- Remove Sub String by using Python
- Type of compiled regex object in python
- How does python and the regex module handle backslashes?
- How to tell if one regular expression matches a subset of another regular expression?