[Geany-Users] Find, regex, spans lines

Lex Trotman elextr at xxxxx
Fri Aug 1 10:00:50 UTC 2014


On 1 August 2014 19:39, Péter <peter20 at mpp.hu> wrote:
> Colomban Wendling wrote:
>>>
>>> Do you experience the same?
>>
>> Yes
>
>
>> use "anything but Q or newline": [^Q\r\n]
>
>
> OK, I accept it.
>
> [^Q\n]*Q
> works. (Finds only inside one line.)

We were not sure what you were actually trying to achieve, but if this
does it then thats ok. :)

>
>
> Lex Trotman wrote:
>>
>> though you can set flags in the regex (?m).
>
>
> I did not really succeed to use it. (I found the
> http://www.geany.org/manual/gtk/glib/glib-regex-syntax.html page.)
>
> Neither of these worked:
> (?m)[^Q]*Q
> (?s)[^Q]*Q
> (?-m)[^Q]*Q
> (?-s)[^Q]*Q

The above page says:

Characters that might indicate line breaks are never treated in any
special way when matching character classes, whatever line-ending
sequence is in use, and whatever setting of the G_REGEX_DOTALL and
G_REGEX_MULTILINE options is used. A class such as [^a] always matches
one of these characters.

So the [^Q] still matches the newline.  Note that unlike some editors,
Geany stores the line ends in the buffer like any other character, so
it can match like any other character.  Hence Colomban's suggestion
above to include the newline in the character class you don't want
matched.

The multiline flag only affects the anchors (^ and $).



Cheers
Lex

>
> --
> Péter
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/users


More information about the Users mailing list