- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 compare two strings using regex in Python?
We can compare given strings using the following code
Example
import re s1 = 'Pink Forest' s2 = 'Pink Forrest' if bool(re.search(s1,s2))==True: print 'Strings match' else: print 'Strings do not match'
Output
This gives the output
Strings do not match
Advertisements