

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to escape all special characters for regex in Python?
We use re.escape() to escape the special characters −
The following code shows how all special characters in given string are escaped using re.escape() method
>>> p = '5*(67).89?' >>> re.escape(p) '5\\*\\(67\\)\\.89\\?'
- Related Questions & Answers
- JavaScript regex - How to replace special characters?
- How can we escape special characters in MySQL statement?
- Escape Characters in Python
- How to escape any special character in Python regular expression?
- Ways to print escape characters in python
- Escape characters in JavaScript
- How to remove all special characters, punctuation and spaces from a string in Python?
- How to use special characters in Python Regular Expression?
- How can I escape HTML special chars in JavaScript?
- Ways to print escape characters in C#
- Special Characters in HTML
- How to replace all the special characters following another character – JavaScript?
- How to count special characters in an R vector?
- How to use Unicode and Special Characters in Tkinter?
- How to match the regex meta characters in java as literal characters.
Advertisements