Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: back translating regular expressions

by blokhead (Monsignor)
on Mar 03, 2005 at 05:27 UTC ( #436096=note: print w/replies, xml ) Need Help??

in reply to Re: back translating regular expressions
in thread back translating regular expressions

What on earth does that have to do with the halting problem? A computer going into an infinite loop is not the halting problem. If you meant that you can't tell whether a regular-expression denotes an infinite language, that's not quite right either. It's infinite if and only if it contains an infinite quantifier (+, *, {m,}), which is an easy property to check.


  • Comment on Re^2: back translating regular expressions

Replies are listed 'Best First'.
Re^3: back translating regular expressions
by Anonymous Monk on Mar 03, 2005 at 10:05 UTC
    does not contain a quantifier, but there are an infinite amount of strings it will match. And if you only want to consider anchored strings:
    my $q1; $q1 = qr /a(??{$q1})?/; my $q2 = qr /^$q1$/;
    matches all strings containing nothing but a's. But it doesn't use any of the quantifiers you mentioned.


    contains a * quantifier, but it doesn't actually match any string. Perhaps you want to discount lookahead. Then I give you:
    It'll give a warning, but all it matches is the empty string. But it does have a * quantifier.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://436096]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2018-06-21 08:59 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.