[thelist] Regular expression to check if other regularexpressions are valid

Carl Edwards edwards at vitesse.com
Wed Jun 22 16:49:20 CDT 2005


If eval is available in your language of choice you can
use it to test the validity of a regex.


>  -----Original Message-----
>  From: lustig at brandeis.edu [mailto:lustig at brandeis.edu]
>  Sent: Wednesday, June 22, 2005 1:25 PM
>  To: VOLKAN ÖZÇELÝK; thelist at lists.evolt.org
>  Subject: Re: [thelist] Regular expression to check if other
>  regularexpressions are valid
>  > which is a valid regular expression with infinitely many positive
>  > lookaheads. I've forgotten the stuff with theory of large 
>  numbers etc,
>  > but hope that an interested can prove that it is 
>  impossible to match
>  > such a regex with a regex.
>  I definitely think that it is possible to create a regex to 
>  match other
>  regexes... I was going to try doing it myself but was 
>  wondering if someone
>  has done it already. THe reason why I think that it is 
>  possible, is because
>  there *is* a pattern to regular expressions. The PHP parser, 
>  for example,
>  knows when there is a syntax error in a regular expression, 
>  because it stops
>  parsing it and throws an error. There is no way to check a 
>  regular expression
>  to see if it does what you want it to do (besides doing a 
>  rigorous proof) but
>  there probably is a (ridiculously complex) regular 
>  expression which will
>  decide whether another regular expression is a valid regex.
>  My idea on this is that the regular expression would look 
>  something like this,
>  but more fleshed out:
>  (something to check beginning of regex) (something to check 
>  inside of regex)
>  (something to check end and modifiers)
>  the "something to check inside of regex" would look like this:
>  [(list of possible characters like \s\S\\s\\S\.\\. etc.)]*
>  and then just put that in a bunch of possible ways to 
>  organize a regex that
>  allows for nesting it in parentheses, etc.
>  Jason
>  -- 
>  * * Please support the community that supports you.  * *
>  http://evolt.org/help_support_evolt/
>  For unsubscribe and other options, including the Tip Harvester 
>  and archives of thelist go to: http://lists.evolt.org 
>  Workers of the Web, evolt ! 

More information about the thelist mailing list