I\'d like to use a variable inside a regex, how can I do this in Python?
TEXTO = sys.argv[1]
if re.search(r\"\\b(?=\\
You can use format keyword as well for this.Format method will replace {} placeholder to the variable which you passed to the format method as an argument.
if re.search(r"\b(?=\w)**{}**\b(?!\w)".**format(TEXTO)**, subject, re.IGNORECASE):
# Successful match**strong text**
else:
# Match attempt failed