I'm using the regex library in python and trying to do fuzzy matching.
I need to use a variable in my search string:
x = regex.search(rf"(?b){variable}{d}",s)
which gives
NameError: name 'd' is not defined
The issue is that I want to specify the type of error with the {d} tag but that is also interpreted as a variable. The only solution I have come up with so far is just to assign d = "d". Looking for a more "proper" way to accomplish this.
Example case:
variable = "amazing"
s = 'amaing analogy'
x = regex.search(rf"{variable}{d}",s)
x.group()
Intended output is: "amazing"