I was wondering if there was a way to detect if a text is "stylized", like these:
ʇxǝʇ uʍop-ǝp!sdn
ⓣⓔⓧⓣ ⓢⓣⓨⓛⓔ
TRANSMITTING
I͇̜̦̦͇̬ͥ͆̀͠'̵̖̠͉̞͓̯̋̑̾̎̽̐ͫͣm̡̠͚̌̽̊̕͢ ̲̰̠̦̝̥̏͋̄̒ͯ̎̄̅̂͝b̷̛̻̎ͬ̚e̵͍̪̯̺̘̣̩̪̭ͨ̇̈̄̌̃̋̉͘h̶̖̮̦ͯͫ̂ͥ̍ͯ̌́͆͞i̸͙͙̖̹̳̝̭̱͗ͤ̌͢n̰͇̟̪̹̭͎͔͐̃ͧ͋ͥ̉d̵̬̰͌̆ͪ͆̔ͯͩ̈́͜ ͚͎͎̽͌̆̒ͬ̀̕y̵͇̰ͧ͊̈́͛͊̓o̤̳̍͌̉ͪ͒u̹͉̝̲̥ͮ̄͟͡
can regex be used to detect those?
(also, sorry if there's a word for those text, I don't know how they're called and I can't find it anywhere)
Those are actually special characters, not stylized text, and you can filter them with a regex like this:
var myText = "abc ⓣⓔⓧⓣ ʇxǝʇ uʍop-ǝp!sdn";
var findSpecial = myText.replace(/[\w\s]/g, ""); // \w is for word chars (letters and numbers) and \s for space; g is for general search (all ocurrences) to replace all regular chars and leave the specials
if (findSpecial != "") {
alert("Text has special char(s): " + findSpecial);
} else {
alert("Text has no special chars.");
}
In this example, the alert will be: Text has special char(s): ⓣⓔⓧⓣʇǝʇʍ-ǝ!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With