Re: Regular expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, November 14, 2006 7:57 pm, John Meyer wrote:
> Is there a way to make a regular expression to match on a particular
> way
> the letters are arranged?  For instance, if you had a word:
> THAT
> It could match on any word in the dictionary that had the form:
> 1231

At 11/21/2006 11:07 AM, Richard Lynch wrote:
For any word with more then 9 unique characters, you are going to have
SERIOUS problems...

Consider this:
supercalifragilisticexpialidocious
123456789105711989...

How can you tell that '11' for the 'g' isn't supposed to be '1'
followed by '1' for two 's' characters in a row?
supercalifrassilisticexpialidocious
123456789105711989...

You may need to represent your digits in, say, hex form, or even in
base 26 form, which gives you the full alphabet as unique digits.


I agree that, of the many ways to encode this, using single ASCII digits would be one of the poorest.

One rather obvious cypher would be the alphabet itself -- a set of one-character symbols of precisely the same number as the characters you want to encode:

php
ABA

that
ABCA

whew
ABCA

supercalifragilisticexpialidocious
ABCDEFGHIJEGKIHIALIFDMCIGHINOFIOBA


Regards,
Abcd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux