Ticket #2886 (closed defect: fixed)

Opened 1 year ago

Last modified 1 month ago

inconsistent use of backslash in regexps

Reported by: vinc17 Assigned to: mutt-dev
Priority: major Milestone: 1.6
Component: doc Version: 1.5.15
Keywords: Cc:

Description

If I want to match the + character from the index, I need to write, e.g.

~Bc\\+\\+

(with two backslashes before the +). But from the pager, I need to search for:

c\+\+

with a single backslash this time.

Change History

2007-05-07 08:15:37 changed by David Champion

* On 2007.05.07, in <038.29cad208b03a923a88ee8ab75959843e@mutt.org>,
*	"Mutt" <fleas@mutt.org> wrote: 
> #2886: inconsistent use of backslash in regexps
> 
>  If I want to match the + character from the index, I need to write, e.g.
>    ~Bc\\+\\+
>  (with two backslashes before the +). But from the pager, I need to search
>  for:
>    c\+\+
>  with a single backslash this time.

This isn't inconsistent, exactly, because the contexts aren't parallel.
When you enter a search expression at the index, the expression is
parsed by the command parser.  At the pager, it's simply a regexp -- no
parsing required.

Annoying, perhaps, but the only solution is to make the pager require a
parse as well, and that would make it inconsistent with external pagers
and general expectation.

2007-05-07 08:50:00 changed by vinc17

Why is it parsed by the command parser in the index? Couldn't the same parser as in the pager be used?

2007-05-07 08:54:05 changed by David Champion

The regexp isn't parsed individually, it's the entire pattern that's
parsed.  So you can do things like:

  ~s 'a subject with a space in it' ~B match.*expression

2007-05-07 08:59:54 changed by vinc17

This should be made clear in the manual. It currently suggests that there is the same parsing in the pager and in the index:

3.2. The Pager
[...]
   /        search for a regular expression (pattern)
                                             ^^^^^^^
[...]
   \        toggle search pattern coloring
                          ^^^^^^^

2007-05-07 09:28:48 changed by brendan

  • component changed from mutt to doc.
  • milestone set to 1.6.

2007-05-07 09:41:21 changed by vinc17

I also wonder if, when invoking the search command in the pager, "Search" should be replaced by "Search (regexp)" or "Search for regexp" (as usually a search/limit/... command expects a pattern).

2008-06-25 22:58:27 changed by brendan

  • status changed from new to closed.
  • resolution set to fixed.

(In [4e37699a7750]) Document difference between index and pager search. Closes #2886.