[clug] OT meta-regex question

Paul Bryan paul at pabryan.mine.nu
Tue Feb 3 03:43:39 GMT 2004


On Tue, Feb 03, 2004 at 02:24:22PM +1100, Gough, Chris wrote:
> For example:
>  A = '^.*$'
>  B = '^foo$'

C = '(A|B)'

or more clearly:

C = '(^.*$|^foo$)'

aPatternExists(C)

>  // this will return true, because both will match the string 'foo'
>  aPatternExists( A, B )
>  A = '^foo$'
>  B = '^bar$'
>  // this will return false, since no string is both 'foo' and 'bar'
>  aPatternExists( A, B )
>  A = 'foo'
>  B = 'bar'
>  // this will return true, since both A and B will match (for example)
> 'foobar'
>  aPatternExists( A, B )
> 

Hope that works - I didn't try it, but I can't see why not.

Cheers,
Paul.


More information about the linux mailing list