After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752719 - Search and replace: problem with look-ahead regex
Search and replace: problem with look-ahead regex
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-22 12:55 UTC by Yannick Voglaire
Modified: 2015-08-23 19:27 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Yannick Voglaire 2015-07-22 12:55:38 UTC
If my document consists of the following line

    Don't match me, match me.

and I try to

    search for: match me(?=\.)
    replace with: please

(with "Use regular expressions" activated) the "Find" button is not greyed out, and it indeed finds the second "match me" (i.e. the one followed by a dot). But the "Replace" button is greyed out, so I can't replace.
This does not happen when the look-ahead "(?=\.)" is removed from the "search for" string. Same with any look-ahead I tried.

This does *not* happen with look-behinds, like

    search for: (?<=, )match me
    replace with: please

i.e. the "Replace" function is fully functional in that case.

The python equivalent

    >>> re.sub("match me(?=\.)", "please", "Don't match me, match me.")
    "Don't match me, please."
    >>> 

does work.

I am using gedit 3.16.2 on Debian testing.
Comment 1 Sébastien Wilmet 2015-07-22 13:13:09 UTC
I confirm with gedit/GtkSourceView 3.17. Thanks for the bug report.
Comment 2 Lope 2015-07-29 09:32:24 UTC
I just experienced this issue as well.
Buffer: , b:184,
Search: , b:(?=\d+,)
Replace: foo

The search regex is found in the buffer and every occurrence is highlighted, but the replace button is greyed out, and the Replace All does nothing, with a "Not found" message shown at the bottom.
Comment 3 Sébastien Wilmet 2015-08-20 15:09:15 UTC
I'm working on it.
Comment 5 Sébastien Wilmet 2015-08-23 19:27:58 UTC
It's now fully fixed:
https://git.gnome.org/browse/gtksourceview/commit/?id=49265d38909e8b4ebab9475bc711f3dd7749299f

I'll backport the commits for the 3.16 and 3.14 versions of GtkSourceView.