I am new to regular expressions and need some help.
How can I turn
string : 7+(4x+2)(3*5)^5
into : 7+(#+#)(3*5)^5
using regular expressions. Is it possible?
basically replace 0-9a-z of string with ( opening 0-9a-z + 0-9a-z ) closing
EDIT
other examples:
string : 3(3+5)^4+8(0+2)
into : 3(#+#)^4+8(#+#)
string : (4+6)
into : (#+#)
string : (4+6)(4+6)
into : (#+#)(#+#)
Try this
See it here on Regexr
These two
(?<=\()and(?=\))is a look behind and a look ahead, they ensure, that there is a bracket before and ahead.\d+[a-z]?is at least one digit followed by one letter.The
+is a special character and needs to be escaped, so\+.Replace this match with