Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Made a comment about red and green highlights missing from code samples


In Groovy, this match flag is "(?x)" and can be combined with other flags you wish to turn on such as "(?ix)" for both extended and case-insensitive modes. This is done in conjunction with Groovy "here" documents (triple quoting), which is handled somewhat differently than the "slashy" quoting used for regular expression patterns. The three examples below are equivalent, but I've highlighted in red what is removed from the first, and colored green the new text in the second and third examples. (Note: the original author didn't figure out how to get the red and green color to work in the code listings for this wiki. If anyone knows how to fix this, please do.)

Code Block
// 1. slashy regex
pattern = ~/(?i)(\d+)\s+\d+%\s+(\/nfs\/data.*)/