View Single Post
Old 06-23-2025, 09:35 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,809
Karma: 6000000
Join Date: Nov 2009
Device: many
I am not sure now that this is a bug in PCRE2 or Sigil.

Sigil's internal PCRE2 runs always in what PCRE2 calls multi-line mode and if you turn off DOTALL then you are forcing it into single line mode as it can not go past the end of line (newline) char, when DOTALL is off.

To do what you want in regex multiline mode (the default for Sigil search) and to make sure you get the full text of each line and even the full text of the last line even if does not end in a newline, the following regex works just fine in PCRE2 multi-line mode.

^.*\n?

But please be aware that new lines can be inside of tags themselves not just in the text in between. So searching line by line is possible but not a good idea in general when processing multi-line text like xhtml.

Typically when in multi-line mode you set DOTALL to be true so that newlines characters can be treated just like any other character when matching.

I am still not sure. The behaviour is strange but given Sigil's PCRE2 is hard coded to multi-line mode, it appears to be more a limitation than a bug.

I will keep digging.
KevinH is offline   Reply With Quote