Re: perl-ish regexps?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Tom Eklvf wrote:

> I was wondering if anyone would be willing/capable
> of implementing perl-like regexps, in a function called
> regex() or something?

You might be able to hack something from my "Regular Expression Matcher",
found in the Euphoria archive. It's aimed at LEX-type expressions, but it's
not that far from what you are aiming for.

> result = regex({^\(d).?\1$}, myVar)

Try instead:

  result = regex("^\\(d).?\\1$", myVar)

You need quotes {"} instead of faces {{}}, or Euphoria will try to evaluate
your expression. In addition, the backslash {\} is a poor selection in
Euphoria. It is used to delimit special characters, like

    \t (tab)
    \n (new line)
    \r (carriage return)
    \" (quote)
    \' (single quote)
    \\ (backslash).

> x = "m5439'.e5588/#s...-*''s009989/&a785784g4654677,,.^^(((~~e"

Same problem as above:

  x = "m5439'.e5588/#s...-*\''s009989/&a785784g4654677,,.^^\(((~~e"

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu