regex over multiple lines in Groovy

前端 未结 3 1920
南旧
南旧 2021-02-06 22:00

I have a multiple line string like following:

END IF;

EXECUTE IMMEDIATE \' CREATE INDEX #idx1
      ON somename ( row         


        
3条回答
  •  面向向阳花
    2021-02-06 22:28

    (?m) makes the regex multiline - allows you to match beginning (^) and end ($) of string operators (in this case, to match the beginnings and ends of individual lines, rather than the whole string):

    /(?m)(EXECUTE).*?;/
    

    (?s) - dotall flag - makes the regex match newlines with . (dot) operators:

    /(?s)(EXECUTE).*?;/
    

提交回复
热议问题