katerina Posted October 4, 2008 Share Posted October 4, 2008 Hi all, I found an algorithm that detects ascii art in a site. I would like to make a function with parameter $url which implementates this algorithm. The algorithm is The following is the summary of ASCII art detection rules: 1. Enclosed by < XMP> or < PRE> elements. 2. One or more occurrences of 4 or more consecutive use of same characters. (characters, or blanks) * A. One or more occurrences of 4 or more same characters consecutively. * B. When ASCII art does not have 4 consecutive letters, it can be identified by occurrences of 4 or more blank spaces. Sample 'A' with 4 or more spaces. Sample 'B' with 4 or more spaces. 3. Generally displayed using more than 10 lines. * A. When greater than 10 lines are used, any ASCII character is used (irrelevant). Sample with more than 10 lines. * B. When less than 10 lines are used, use of non-alphabetic, non-numeric ASCII characters outweigh the use of alphabetic, numeric ASCII characters. - 4 lines for a sleeping kitten ASCII art - 6 lines for heading using ASCII art Link to comment https://forums.phpfreaks.com/topic/127011-detect-ascii-art/ Share on other sites More sharing options...
zq29 Posted October 4, 2008 Share Posted October 4, 2008 You'll need to write a (number of) regular expression(s) and implement them with something like eregi() or preg_match(). Link to comment https://forums.phpfreaks.com/topic/127011-detect-ascii-art/#findComment-657080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.