locked
Find String between a 2 strings RRS feed

  • Question

  • I have a need to find if a string exists between 2 strings, but the string may or may not be on the same line.

    I am looking for a "delete" with a "where"

    so here is an example:

    Delete from table where name = bob;

    or 

    Delete from table 

    where name = bob;

    If there is not 'where' between the 'delete' and ';' I need to find that.   I do not need the string between the strings, just if the work "where" exists.

    Monday, April 30, 2018 3:08 PM

All replies

  • what do you  mean by string between the strings here ?

    Regards kvprasoon

    Monday, April 30, 2018 8:13 PM
  • $s = @'
    Delete from table
    
    where name = bob;
    '@
    $s -match '(?smi)delete.*where.*;'
    


    \_(ツ)_/

    Monday, April 30, 2018 8:30 PM