Regex replace group reference and Unicode escape conflict
I am working on a latin to N'ko translator. I get a warning for this type of code: text=re.sub(r'([ߊߍߋߌߐߏߎ][\u07F2]*)\u0300','\g<1>\u07EC',text,0,re.UNICODE|re.MULTILINE) SyntaxWarning: invalid escape sequence '\g' I get an error for this correction on the second term: text=re.sub(r'([ߊߍߋߌߐߏߎ][\u07F2]*)\u0300',r'\g<1>\u07EC',text,0,re.UNICODE|re.MULTILINE) re.error: bad escape \u at position 5 A double slash \\u instead of \u: no warning and no error message but the whole string u07EC gets inserted, not the Unicode character. What am I missing here?
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.