Home > Archive > PERL Miscellaneous > August 2005 > minimalist regular expression
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 |
minimalist regular expression
|
|
| borges2003xx@yahoo.it 2005-08-25, 6:57 pm |
| Exists some tool, programs or some able to compute the minimal regular
expression, namely ,taking a series of regular exoression, the minimal
one that makes the same matching?
thanx in advance
| |
| John Bokma 2005-08-25, 6:57 pm |
| "borges2003xx@yahoo.it" <borges2003xx@yahoo.it> wrote:
> Exists some tool, programs or some able to compute the minimal regular
> expression, namely ,taking a series of regular exoression, the minimal
> one that makes the same matching?
> thanx in advance
length? (define minimal) :-D.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
| |
| borges2003xx@yahoo.it 2005-08-26, 7:56 am |
| the shortest description in regex way
| |
| Paul Lalli 2005-08-26, 7:56 am |
| borges2003xx@yahoo.it wrote:
> Exists some tool, programs or some able to compute the minimal regular
> expression, namely ,taking a series of regular exoression, the minimal
> one that makes the same matching?
> thanx in advance
m//;
it matches everything. Perhaps you need to better define your problem
statement. Sample input, desired output...
Paul Lalli
| |
|
|
| Paul McGuire 2005-08-26, 6:57 pm |
| Google for "optimized regexp" returns:
http://laurent.riesterer.free.fr/re...ake-regexp.html
http://search.cpan.org/~dankogai/Regexp-Optimizer-0.15/
There are several more links, but all appear to be written in languages
other than Python. Perhaps you could port one of them.
It also seems that a similar thread came up here recently, at least in
the special form of converting a list of words to a single regexp. In
general, this seems to be a difficult problem, not only to implement,
but to test. At least the conversion of a list of words to a single
regexp is easily tested against the input set, although as some of the
other clever posters have noted, it is possible to create a regexp that
is *too* matchable.
-- Paul
| |
| Brian McCauley 2005-08-26, 6:58 pm |
|
Paul Lalli wrote:
>
> m//;
>
> it matches everything.
Not in Perl it doesn't. :-)
| |
| Paul Lalli 2005-08-26, 6:58 pm |
| Brian McCauley wrote:
> Paul Lalli wrote:
>
> Not in Perl it doesn't. :-)
Sure it does.... provided you haven't tried matching anything else
beforehand...
Paul Lalli
| |
| borges2003xx@yahoo.it 2005-08-26, 6:58 pm |
| Whenever I ask a match in a string for(a{3,}b and match for (a{1,}, the
first is implicit second: ab is implicit in a.*;automatically
| |
| Anno Siegel 2005-08-29, 7:56 am |
| [newsgroups trimmed]
Paul Lalli <mritty@gmail.com> wrote in comp.lang.perl.misc:
> Brian McCauley wrote:
>
> Sure it does.... provided you haven't tried matching anything else
> beforehand...
It's okay if he only tried matching something else. It starts not
matching things if he tried and succeeded.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
|
|
|
|
|