0

I have got this string:

test = "access-list [a-zA-Z0-9_/-]+ deny any\n"

and i have this variable:

regex = r"[a-zA-Z0-9_/-]+"

now i want to change the original string, i want to subtract the variable value in the string and insert another one. so that i get something like this.

test = "access-list new_value deny any\n"

i have tried to do this, but it failed:

test_replacement = test.replace(regex, "new_value")
M.Kälin
  • 11
  • 5

0 Answers0