- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
- Related Articles
- How to compare two strings in Golang?
- How to Match patterns and strings using the RegEx module in Python
- How to compare date strings in Python?
- Compare two Strings in Java
- Program to Compare two strings in Java
- Java Program to Compare Two Strings
- How to compare two strings which are numbers in MySQL?
- How to compare two strings without case sensitive in Java
- Compare two strings lexicographically in C#
- Compare two strings lexicographically in Java.
- Java Program to Compare two strings lexicographically
- How to compare two strings in the current locale with JavaScript?
- How to compare two variables in an if statement using Python?
- Write a C program to compare two strings using strncmp library function
- How to compare histograms of two images using OpenCV Python?

Advertisements