I've been trying to cleanup some text. But got stuck on regex, finally got around with re.sub. But end up with syntax error. Original Code: #Test for name cleanup
Test for name cleanup
import re
input = u'CHEZ MADU 東久留米店(シェマディ)【東京都東久留米市】'
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
print(re.sub(input, pattern, ''))
Gave me this error:
File "retest01.py", line 6
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
^
SyntaxError: invalid syntax
I've been testing code from another regex thread: python regular expression with utf8 issue
It gave same error. What could be possible the source of problem here?
I've been trying to cleanup some text. But got stuck on regex, finally got around with re.sub. But end up with syntax error. Original Code: #Test for name cleanup
import re
input = u'CHEZ MADU 東久留米店(シェマディ)【東京都東久留米市】'
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
print(re.sub(input, pattern, ''))
Gave me this error:
File "retest01.py", line 6
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
^
SyntaxError: invalid syntax
I've been testing code from another regex thread: python regular expression with utf8 issue
It gave same error. What could be possible the source of problem here?
I've been trying to cleanup some text. But got stuck on regex, finally got around with re.sub. But end up with syntax error. Original Code:
Test for name cleanup
import re
input = u'CHEZ MADU 東久留米店(シェマディ)【東京都東久留米市】'
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
print(re.sub(input, pattern, ''))
Gave me this error:
File "retest01.py", line 6
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
^
SyntaxError: invalid syntax
I've been testing code from another regex thread: python regular expression with utf8 issue
It gave same error. What could be possible the source of problem here?
Python Regex UTF-8 Syntax error
I've been trying to cleanup some text. But got stuck on regex, finally got around with re.sub. But end up with syntax error. Original Code: #Test for name cleanup
import re
input = u'CHEZ MADU 東久留米店(シェマディ)【東京都東久留米市】'
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
print(re.sub(input, pattern, ''))
Gave me this error:
File "retest01.py", line 6
pattern = re.compile(ur'(【(.*?)\】)', re.UNICODE)\
^
SyntaxError: invalid syntax
I've been testing code from another regex thread: python regular expression with utf8 issue
It gave same error. What could be possible the source of problem here?