Unix Shell - How I can print RE's possibility ?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > November 2006 > How I can print RE's possibility ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How I can print RE's possibility ?
Key9

2006-11-22, 1:17 pm

Hi all

When we wrote an RE, for example
'(foo)\{2,\}'

Is there exist any command we can print the whole possibility of this RE?


Thank you very much!

your key9


Janis Papanagnou

2006-11-22, 1:17 pm

Key9 wrote:
> Hi all
>
> When we wrote an RE, for example
> '(foo)\{2,\}'
>
> Is there exist any command we can print the whole possibility of this RE?


If I understand you correct you want to know all (or a few) words that
are part of the language defined by this RE?

It seems that (for a slightly different syntax) someone in comp.lang.awk
had provided some awk program for that. Look for a recent thread called
"A programming problem solution." in the newsgroup comp.lang.awk.

Janis

>
>
> Thank you very much!
>
> your key9
>
>

SiKing

2006-11-22, 1:17 pm

Key9 wrote:
> Hi all
>
> When we wrote an RE, for example
> '(foo)\{2,\}'
>
> Is there exist any command we can print the whole possibility of this RE?
>
>
> Thank you very much!
>
> your key9


If there were such a command, which I believe is not, what would you like to see
if you passed the RE '.*' to this command?

Try this: <http://regexlib.com/RETester.aspx>.

HTH.

--
mean people suck, naughty people swallow :o
-----
Candy for spammers:
http://members.shaw.ca/grubb/spamthis.html
Key9

2006-11-22, 1:17 pm

> If I understand you correct you want to know all (or a few) words that
> are part of the language defined by this RE?
>



no ,sorry for my poor English
for example we can using
$grep '(foo)\{2,\}' foo.text
to list foofoo foofoofoo ...... in foo.text

but is there exist some tools we can do such tings
$cmd '(foo)\{2,\}'

after this command we can enumerate all possibility of RE?
foofoo
foofoofoo
foofoofoofoo
....

Of course it is not "safe" because RE like this one is infinituded


Janis Papanagnou

2006-11-22, 1:17 pm

Key9 wrote:
>
>
>
> no ,sorry for my poor English
> for example we can using
> $grep '(foo)\{2,\}' foo.text
> to list foofoo foofoofoo ...... in foo.text


Maybe my English is also quite poor; that's exactly what I wanted to
express.

>
> but is there exist some tools we can do such tings
> $cmd '(foo)\{2,\}'


Have a look at the reference to comp.lang.awk that I gave upthread.

>
> after this command we can enumerate all possibility of RE?
> foofoo
> foofoofoo
> foofoofoofoo
> ...
>
> Of course it is not "safe" because RE like this one is infinituded


The program I was talking about will only print the first (three or so)
words if the language has an infinite number of words.

Janis
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com