-2

For example, I want to replace all the data going from the specified intervals with * (except the chars u0650, u0660, u064F), for example.

Note: I don't want to break the interval because I have a lot of characters to preserve.

data = re.sub(r'[\u0600-\u061E\u0620-\u065F\u0670-\u06ef]', "*", data)
Moun
  • 325
  • 2
  • 16

1 Answers1

1

You can put the characters to be excluded in a negative Lookahead before the main character class.

For example:

(?![\u0650\u0660\u064F])[\u0600-\u061E\u0620-\u065F\u0670-\u06ef]

Demo.