[texworks] regexp: start and end of line and more

Stefan Löffler st.loeffler at gmail.com
Thu Sep 24 13:19:35 CEST 2009


Jérome Laurens schrieb:
> Is there a mean to have ^ match at the beginning of a line and not the
> beginning of a string
> the same for $
> At least simulate this would be a poor man solution

As described in
http://doc.trolltech.com/4.5/qregexp.html#notes-for-perl-users, this is
not supported directly but must be simulated by applying the regexp to
each line in turn. For implementation comments see below.

> I don't find very comfortable with the lack of choice between greedy
> and non greedy wildcard matching in the same expression.

As described in
http://doc.trolltech.com/4.5/qregexp.html#notes-for-perl-users as well,
it seems that Qt doesn't support to have both greedy and non greedy
quantifiers in one pattern. It does support, however, to turn all
quantifiers into non greedy ones.

Regarding the implementation, I would consider these options (and
possible others I can't think of right now) expert options (as is the
whole regexp thing). Hence I'm in favor of including them, but I'm
against showing them to the average user unless he decides to use
regexps. As such, I propose some kind of flap out or something that only
becomes available when the user enables regexps. Since this involves UI
changes (causing problems with translations and other stuff) I guess
this won't be done until the first official release (after all, the
regexp feature is usable within the confines of the default options). I
added it as issue 194
(http://code.google.com/p/texworks/issues/detail?id=194), though.

> When a search gives no match, the list of the previous results in the
> upper part of the editor window should be erased, or at least
> something should clearly indicate that this list has nothing to do
> with the actual search pattern.

I concur. See issue 193
(http://code.google.com/p/texworks/issues/detail?id=193) for a patch.


More information about the texworks mailing list