Is there a shortcut for word boundary in `less`?

unix

Solution

Your version of `less` was built with posix regular expressions, as if:

wget http://ftp.gnu.org/gnu/less/less-451.tar.gz
tar zxf less-451.tar.gz
cd less-451
./configure --with-regex=posix
make

However, apparently the cause of whether `\<` works or not does NOT depend on this:

- In Debian/Linux, `\<` will work fine even if you build with the above commands, with posix regex

- In Mac OS X, I tried all possible values of `--with-regex` except `pcre`, and `\<` doesn't work with any of them. If I build with `pcre`, then `\b` works, instead of `\<`.

To conclude, I don't know how to make it work with `\<`. But you can build yourself with `pcre` and then it should work with `\b`. If you are not a sysadmin, you probably want to use a `--prefix` to install under your home directory, for example `--prefix=$HOME/opt`. After the `make` step, confirm it works with `./less /path/to/some/file`. If looks good, then finish with `make install`.

Problem

This is the less I am using: ``` less 458 (POSIX regular expressions) Copyright (C) 1984-2012 Mark Nudelman ``` In Vim it is `\<` and `\>`, in most other regex it is `\b`.

Original source