Closed superian closed 4 years ago
^
works as expected. I can't reproduce your issue.
test.txt
11.aaa 222
11 aa 222
11 aaa 222
11
^\d{2}\.\w{3}+.*
regex: ^\d{2}\.\w{3}+.*
It's lovely that it works for you. It doesn't here
^def
should find 'def' at the start of a line, right?
Given a file of
abcdef
defabc
xyzabc
It should find the text on the second line. It doesn't.
def$
doesn't find the text in the second line either. But
[d-f]
works for finding each d/e/f - so it is doing a regex search.
BUT the issue here is that there is zero about this in the help, in the man page, and on the wiki.
duplicate of https://github.com/mate-desktop/pluma/issues/323 ?
EDIT: ah no, this issue is only with the help documentation
Yes :) I don't know if the failure to use the ^ 'start of line' regex character is a bug in the search or a feature of the syntax it's using, because I can't find what the syntax actually is in the obvious places to look. Or anywhere, without looking at the source code + that of any dependencies.
@superian The regex syntax is available at https://developer.gnome.org/glib/stable/glib-regex-syntax.html
Thank you! Can this - or a slightly more 'general user' friendly adaptation of it - be added to the help.
Neither ^ | assert start of string (or line, in multiline mode) $ | assert end of string (or line, in multiline mode) work as I'd expect here, but that's another issue.
\ndef
finds the def at the start of the second line, but at the cost of including the previous linefeed.
multiline mode can be enabled adding (?m)
in the search pattern or modifying the source code
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c
index 761d0c7..da71e68 100644
--- a/pluma/pluma-utils.c
+++ b/pluma/pluma-utils.c
@@ -1573,7 +1573,7 @@ pluma_gtk_text_iter_regex_search (const GtkTextIter *iter,
gboolean found;
match_string = "";
- compile_flags = 0;
+ compile_flags = G_REGEX_MULTILINE;
if ((flags & GTK_TEXT_SEARCH_CASE_INSENSITIVE) != 0)
compile_flags |= G_REGEX_CASELESS;
Thanks, but that's not in the program's documentation either :)
I've opened another issue about that aspect, but saying 'modify the source code' is not a realistic option for most users. If I submitted a request with it done, would it be accepted?
Thank you.
I wanted to search a file in Pluma for a regular expression. I can't remember which regex syntax it uses, but ^ for 'start of line' doesn't work. OK, let's look it up.
Expected behaviour
Being able to find it in help Being able to find it in the man file Being able to find it on wiki.mate-desktop.org
Actual behaviour
The application help does not mention regular expressions at all. "Finding Text" says there are some 'special characters', but those are only \n, \t, \r, and \. "Find and Replace Options" doesn't mention the regular expressions option that's been there for a while.
The main file is about the command line, rather than using the editor. It suggests "Further information may also be available at: http://wiki.mate-desk-top.org/docs". That URL no longer exists.
wiki.mate-desk-top.org - hmm, where is it? Documentation? There's a list of some MATE applications there, but not Pluma. Applications? Pluma is listed, but that's all and there's no linked to page(s) on it. No other pages seem to have anything, and the wiki reckons the current stable and development versions are 1.22 and 1.23.
OK, do a Google search for
"pluma" "regex"
Nine pages of results, nothing useful on the first page, and nothing obviously useful on the other eight.
"pluma" "regular expression"
Eight pages, ditto.
Steps to reproduce the behaviour
MATE general version
1.24
Package version
1.24
Linux Distribution
Ubuntu MATE 20.04 LTS beta
Link to downstream report of your Distribution