lf icon indicating copy to clipboard operation
lf copied to clipboard

Regular expression support in search

Open AndreJesusBrito opened this issue 2 years ago • 3 comments

It would be cool if we could use regular expression to search for files and directories like in vim One nice complement is if the count of matched is displayed.

Some use cases:


// All files stating with the letter a
/^a/

// all photos from 2022
/^IMG_2022.+/

// all go files in directory
/.+\.go$/

Also (I don't know if is possible yet) the possibility to select all files that match the search pattern.

AndreJesusBrito avatar Dec 27 '22 11:12 AndreJesusBrito

lf does not support regular expressions in search, but it does support globs (set globsearch). Your examples could be rewritten in globs like this:

a*
IMG_2022*
*.go

en0mem avatar Dec 31 '22 05:12 en0mem

Thank you @SeekingBlues I didn't know about globsearch.

However I still think that would be useful to have regular expressions anyway. For example to select all .js and .jsx but no .json will not work for globsearch.

AndreJesusBrito avatar Jan 04 '23 23:01 AndreJesusBrito

Not only search, filter should have it, too. Globs aren't powerful enough.

aksr avatar Jan 29 '23 23:01 aksr