I have tried various pattern combinations including "[.\r\n]+" and "[\w\s\r\n+" etc. I do quite a lot of Regular Expression construction and am reasonably familiar with the PCRE syntax. So far I've had no luck, hence the posting.

If you could tell me which Reg Ex library you're using in Zeus I could check the documentation on its syntax variant.

I have tried various pattern combinations including "[.\r\n]+" and "[\w\s\r\n+" etc.

Unfortunately these types of searches will not work in Zeus

Zeus stores each line of the document in a separate buffer meaning the document is held in many disjointed blocks of memory. But the regular expression engine only works if the data is held in a continuous block of memory.

So to make the \n search work for this kind of discontinuos memory Zeus does some extra work. What Zeus does is count the number of \n characters in the search pattern, then concatenates that many lines plus one into a working buffer and passes that on to the regex engine.

So in your case there is only one \n so at most only two lines will be searched at any one time.

So to make the \n search work for this kind of discontinuos memory Zeus does some extra work. What Zeus does is count the number of \n characters in the search pattern, then concatenates that many lines plus one into a working buffer and passes that on to the regex engine.

I would like to, for instance, search and replace multi-line comments marked with "/*" and "*/" delimiters. The number of lines contained between the delimiters is unknown.

In the previous p+ example the search would have found single or multiple numbers of the p character. For example it finds the multiple ppp pattern at the end of the line.

The reason this happens is because the search defaults to being greedy and as such it will try to consume as many matching characters as possible.

In some cases a more lazy match is preferable and this can be achieved by appending the '?' operator to the end of the search string.

Yep that'll do it, (to be honest I was thinking of a pattern modifier like the "/U" used in PHP, but thats non-standard and unnecessary).

Having said this, when testing these patterns I did noticed a slight bug in Zeus

If for example you use the 12 line pattern and you have two small block comments only a few lines appart, the second block will not be found as it will have been consumed by the earlier concatenation used to find the first

If for example you use the 12 line pattern and you have two small block comments only a few lines appart, the second block will not be found as it will have been consumed by the earlier concatenation used to find the first

There may well be even a better way to express this, but the secret is the number of \n's found in the search string will represent the maximum number of lines of the block comment found that can be found.