GNOME Bugzilla – Bug 752719
Search and replace: problem with look-ahead regex
Last modified: 2015-08-23 19:27:58 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.
I confirm with gedit/GtkSourceView 3.17. Thanks for the bug report.
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.
I'm working on it.
Not completely done, but there is some progress: https://git.gnome.org/browse/gtksourceview/commit/?id=c1039c448a7a501561b28c7708e50e400faf7c5e https://git.gnome.org/browse/gtksourceview/commit/?id=53dc07e157e9219a0a3561b4ea228363a1deafdb
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.