0

I copied a simple regex from here to remove accented letters but its giving an error.

import re
import unicodedata

class Profile(models.Model):
    name = models.CharField(max_length=200, blank=False)
    def name_breakdown(self):
        newName = re.sub(r'\p{Mn}', '', unicodedata.normalize('NFKD', self.name.lower()))
        return newName

the error:

bad escape \p at position 0

What do I do to resolve this?

Prosy Arceno
  • 2,361
  • 1
  • 5
  • 24
  • 2
    Scroll to *Diacritics support with Python re* at the linked thread. Or, use `import regex` to use PyPi regex module that supports Unicode property classes. – Wiktor Stribiżew Jun 17 '21 at 18:14

0 Answers0