Skip to content

Commit 18cbbae

Browse files
Create TwoRegexComparator.py
This can compare two regex statements and can tell is there any difference.
1 parent 4add02f commit 18cbbae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

TwoRegexComparator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import re
2+
3+
regex1 = r"hello (world|universe)"
4+
regex2 = r"hello (universe|world)"
5+
6+
if re.compile(regex1).pattern == re.compile(regex2).pattern:
7+
print("The two regular expressions are equivalent.")
8+
else:
9+
print("The two regular expressions are not equivalent.")

0 commit comments

Comments
 (0)