Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dot "." to match newlines by default #111

Closed
jakwings opened this issue Oct 13, 2017 · 2 comments
Closed

Allow dot "." to match newlines by default #111

jakwings opened this issue Oct 13, 2017 · 2 comments

Comments

@jakwings
Copy link
Contributor

It may seems dangerous to include newlines in the output, though there is an option -0, --print0 to help.

But even if the so called "dot-all" feature is disabled, we still can match those files with empty pattern "", ^, [^/]*, etc.

@sharkdp
Copy link
Owner

sharkdp commented Oct 14, 2017

I'm glad that I've never experienced a file with a newline in the name, but I think we should enable this, as you said. It's better to show these results in a potentially confusing way than to not show them at all. And -0, --print0 can help, exactly.

Note that this feature can be enabled via (?s):

> ls
'a'$'\n''b'

> fd 'a.b'

> fd '(?s)a.b'
a
b

This should be easy to implement via RegexBuilder::dot_matches_new_line.

@sharkdp sharkdp mentioned this issue Oct 14, 2017
5 tasks
@jakwings
Copy link
Contributor Author

jakwings commented Oct 14, 2017

Ok, I included the patch in #96.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants