I was trying to insert a date into a string, using regular expression in python
link = 'branch=;deps=;date=;rev=;days=1;user='
date = "10.12.2016"
re.sub(r'(.*)(date=[^;]*)(.*)','\\1\\2'+date+'\\3',link)
I was expecting the output to be
'branch=;deps=;date=10.12.2016;rev=;days=1;user='
but I got this instead,
'branch=;deps=;**\x88.12.2016**;rev=;days=1;user='
Another thing if I have some character string in the date variable, it is replacing just fine.
date="hello"
re.sub(r'(.*)(date=[^;]*)(.*)','\\1\\2'+date+'\\3',link)
gives,
'branch=;deps=;**date=hello**;rev=;days=1;user='
What could be the problem here?