I'm trying to solve one of the Regex problem with python, the input format for the problem is:
This$#is% Matrix# %!
Output supposed to be:
This is Matrix# %!
I am new in Regex so I find a solution of it as:
re.sub(r"(?<=\w)([^\w]+)(?=\w)", " ", string) #string is input
This code worked well and give desired output but I'm not able to understand what is the meaning of (?<=
and (?=
in the code or how it works? If anyone can explain so please...