in reply to regex help needed

Two quick possibilities come to mind, based upon your provided input:

  1. Since 'DONE' is the last element of your string, you could anchor to the end of the string with ^ (Regular Expressions), a la:

    $string =~ /DONE$/i;

  2. If you know the only undesirable DONE follows echo and will be the only one that follows echo, you could use a negative look behind assertion (Looking ahead and looking behind) to skip that case:

    $string =~ /(?<!echo\s)DONE/i;

Replies are listed 'Best First'.
Re^2: regex help needed
by Anonymous Monk on Jul 17, 2009 at 16:56 UTC
    using the negative look behind worked...thanks!