[SOLVED] Is there python Function to remove word between special character and space

Issue

I’m trying to remove the *@hmo2406* word using the below function. Could you check and help me?

'*@hmo24* وين هل الغيبه  '

>>> import re
>>> re.sub('\n@.*?\n','',a, flags=re.DOTALL)

Solution

If you’re removing non-Arabic characters from your string then try this:

import re 

text = '*@hmo24* وين هل الغيبه  '

arabic_string = " ".join(re.findall('[\u0600-\u06ff]+', text))

print(arabic_string)

Output:

وين هل الغيبه

Answered By – Shaida Muhammad

Answer Checked By – Jay B. (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *