Created
October 31, 2019 08:47
-
-
Save sagorbrur/d7f0fc3e9a98d87c2be513e37bfefa64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
TEXTO = sys.argv[1] | |
my_regex = r"\b(?=\w)" + re.escape(TEXTO) + r"\b(?!\w)" | |
result = re.search(my_regex, subject, re.IGNORECASE) | |
print(result) | |
# ref | |
# https://stackoverflow.com/questions/6930982/how-to-use-a-variable-inside-a-regular-expression | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment