in reply to Regex question

If the second variable is always just 2 numbers seperated by a "." I'd suggest doing it this way:

 if ( "$var2." eq substr("$var1.", 0, 1+length $var2) ) { ... }

Not a regex thou...

Update at -2: Yes! It's not a regex. But: Why should one use a regex here where a simple string comparison will do?

Could those downvoters please comment what they think is wrong with my solution except that I don't break a fly on the wheel.


s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^2: Regex question
by CountZero (Bishop) on May 22, 2007 at 13:14 UTC
    Very clever, adding a dot after the variables to make sure you do not get a false positive in case of partial matches!

    ++ wel deserved.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law