Re: Regular Expression Generator



On 26 Jun 2006, jeremyje@xxxxxxxxx wrote:

Is there a library or a way to generate an appropriate regular
expression for any given input string?
(remove quotes for examples)
For example: "1234567890abcdef is in hex9"
Regex Generator returns: [0-9|A-F]{16} [a-z]{2} [a-z]{2} [0-9|a-z]{3}

Or anything that does some sort of similar processing?

I only know of this one:

http://search.cpan.org/~dankogai/Regexp-Optimizer-0.15/lib/Regexp/Optimizer.pm

Emacs also has a regexp-opt function you may find interesting (as an
alternate approach in a different language).

Ted
.



Relevant Pages

  • Re: preg_match
    ... Experimenting and googling for a few hours didn't get me ... My input string could look ... The values could be enclosed in single quotes, ...
    (comp.lang.php)
  • Re: Regular Expression Generator
    ... expression for any given input string? ... For example: "1234567890abcdef is in hex9" ... Or anything that does some sort of similar processing? ... A graphical character like ',' would mean that all lines in the file had ...
    (comp.lang.perl.misc)
  • Re: Regular Expression Generator
    ... expression for any given input string? ... For example: "1234567890abcdef is in hex9" ... Or anything that does some sort of similar processing? ... Without knowing the generic pattern it is impossible to know ...
    (comp.lang.perl.misc)
  • Re: Escapes and String Replacement
    ... > on your keyboard. ... That's just because of the double quotes. ... asis. ... the input string was not inside double quotes ...
    (comp.unix.shell)
  • Re: Regular Expression Generator
    ... (remove quotes for examples) ... For example: "1234567890abcdef is in hex9" ... Or anything that does some sort of similar processing? ... IOW There is no single "appropriate regular expression" but infinitly many (or some number close to infinity) that it's unpractical. ...
    (comp.lang.perl.misc)