5

lately I have spotted many spam streads showing strange text behaviour like the following: enter image description here

i tried to understand this but even chromes tools won't help much: enter image description here

I have some websites online and want to implement a better spam protection client- and serverside but I need to know what to check in the first place. I need to know how this is done and maybe if it could be detected with a regex pattern.

any help would be appreciated!

p.s.: I wanted to write a better headline but I don't even know how this text behaviour is called and I didn't find anything on google

QQping
  • 1,360
  • 13
  • 26
  • 5
    It's colloquially known as "Zalgo text." Ṯ͔̟̻̭̙̉ͭ̆ͪͮ̽̑ͦ͝ȏ̞̬͛̎̿͛͊͆ͯ̕ ͙͓̣ͧ̒́̆́͛́î̦͎̮͎̥͙̘͉̀͗̽̾̑̇̕n̷̼͙̥͕͈͉͕̼ͥ͛ͣͬ̍ͩͨ̎́͜v̳͇͉͓̱ͬ͑͗ͩ̈͆̍ͫ̕ơ̥ͣ̍͗́k͇̹̲͚̓͑ͣ̈̆͞ë̡͔͕̬͋ͦ̇͒̚ ̧̞̗͙̞͉͈̆ͯͣ̌ͧ̕t̠̺͎̟͎͕̯̬͐͘h̷̳͚̪̀̒̉ͨ͞e̡̪̜̠̤̹̯̓ͭ̎̚ ̧̲̯̣̣̖͗͊̊͒ͅh̞̲͎͖̣͎ͫ͗ͣ̈́̄̈i̛ͣ̿̒̄̎̇ͫ̽ͦ҉̦̠v̭̯͍̼͂͂͒́ͦͬ̍ͭe͈̙̻̭͎̗̦͕̾̀-̨ͦͪ͆҉̞̪̞̗̬̦ṁ̡͇̱̋ͨ́̉̃͒͑̀į̰̝̠̈́ͪͪͭ̿͋ͩͤ͠ͅn͚̙̣͎̣͐ḓ̨̧́̂̽̉̑͘ ͤ̊̾̋ͬ͏͚̭̜͙̦ȓ̻͙͕̪͎̼̦̦ͭ̀ͪ̏͝e̛̹͊̀p̶͎͙̱̘̲̣̤͗ͮ͘͡r̢̛̥̹̥͓̰̳̖̪̖̓ͬ͊̿̌̐ͭ̿̊͞e̴̝̟̬̥̹̭̝̬͗ͯ̏̈́ͪ͑̀s̷͈̤̙ͭ̀ę̘̙͚͇̪̲̘̉̔ͬ͢nͣ̕҉̛̤̭͖̪̝t͖̗̘̤͍̱̜͑ͭ͟͝i͖̹̖̹̮͙ͥͣ͊͡ͅn̪̯̰̪̗̈̂ͩ͒͋͠g̨̯̫̜̣̠̍ͧ͑̈̐ͩ͌͝ ̴̦͚͖͕̮̗ͫ̿̇̎ͩ͠͠c̰̹͇͙̣̔̄̆͜h̗̪̣͔͍ͨ̌ͭ͡a̵̳̥̝̹̤̣̗͎͐͟͝oͬͦ͏̜͕̱͈͖̜̫͇͡ŝ͉̓́̕.̉̂͐́ͫ̅ͫ̓҉̣ – Matt Ball Mar 24 '12 at 18:58
  • 1
    Further reading: http://stackoverflow.com/questions/6579844/how-does-zalgo-text-work. What makes you think it's spam? – Matt Ball Mar 24 '12 at 19:00
  • thanks for the quick reply. these kind of comments are more than annoying when the text overflows other comments so i need to handle them as spam. – QQping Mar 24 '12 at 19:07

1 Answers1

8

It's not really SPAM, it's known as ZALGO. Detecting it in PHP is a bit tricky, try this regexp below:

if ( preg_match ( '/[^\x20-\x7E]/', $text ) || preg_match ( '/[^\x20-\x7E]/', $text ) ) {
    die('ZALGO not allowed');
}
aurbano
  • 3,244
  • 1
  • 24
  • 39
  • I just noticed that this is actually too broad and removes characters like `ñ, ä, ß, ø` just to name a few... – MMachinegun May 23 '16 at 21:30
  • 1
    so if you want to include words from other languages, just add `[^\p{L}\x00-\x7e]/`. `\p{L}` stands for any word in any language. – MMachinegun May 24 '16 at 00:33