This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Tested on Python 3.6.1 | |
| # install: pip install --upgrade arabic-reshaper | |
| import arabic_reshaper | |
| # install: pip install python-bidi | |
| from bidi.algorithm import get_display | |
| # install: pip install Pillow | |
| from PIL import ImageFont |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function validemail(str) | |
| if str == nil or str:len() == 0 then return nil end | |
| if (type(str) ~= 'string') then | |
| error("Expected string") | |
| return nil | |
| end | |
| local lastAt = str:find("[^%@]+$") | |
| local localPart = str:sub(1, (lastAt - 2)) -- Returns the substring before '@' symbol | |
| local domainPart = str:sub(lastAt, #str) -- Returns the substring after '@' symbol | |
| -- we werent able to split the email properly |