First off, you don't need to know Arabic to answer this question, just know Arabic is written from right to left and numbers in Arabic are written from left to right itself.
I am trying to translate an English item into Arabic and print it. for example: "paper roll 2.50m x 3.36m VIP" into Arabic is "VIP لفة ورق 2.50 م × 3.36 م"
I use regex to see if there are any uncovered words (English words and numbers) not to reverse it.
english = re.compile("^[A-Za-z0-9_.]+$")
item_name = "paper roll 2.50m x 3.36m VIP"
''.join(s if english.match(s) else s[::-1] for s in reversed(re.split('(\w+)', arabic_reshaper.reshape(GoogleTranslator(source='en', target='ar').translate(item_name)))))
The issue here is there the regex considers the words as "50", "." and "2" for "2.50" then makes it as "50.2" so the output becomes "VIP لفة ورق 50.2 م × 36.3 م" which is incorrect.
Is there any possibility that I can check if the word is a decimal number and not reverse it using regex?