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 Quote Link to comment 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(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.