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

Regular expressions #20

Closed
zz0rk opened this issue Feb 21, 2022 · 12 comments
Closed

Regular expressions #20

zz0rk opened this issue Feb 21, 2022 · 12 comments

Comments

@zz0rk
Copy link

zz0rk commented Feb 21, 2022

Does the use of regular expressions require Go to be installed?

$ f2 -f ((.*?)) -r '-'
bash: syntax error near unexpected token `('

Thank you

@ayoisaiah
Copy link
Owner

No, you should enclose the find expression in quotes:

$ f2 -f '((.*?))' -r '-'

@zz0rk
Copy link
Author

zz0rk commented Feb 22, 2022

Thank you for your reply.

I am trying to match a pair of parenthesis and everything inside it, see

https://github.com/ayoisaiah/f2/wiki/Regular-expressions
((.*?)) Match a pair of parenthesis and everything inside

The above syntax will generate
bash: syntax error near unexpected token `('

Your suggestion in your reply from above will generate
f2 -f '((.*?))' -r '-'
INFO Failed to match any files

In this case
'Test (some text)' will remain unchanged when the expectation was for it to be changed to
'Test -'

Thank you

@ayoisaiah
Copy link
Owner

@zz0rk You need to escape the outer parentheses:

image

@zz0rk
Copy link
Author

zz0rk commented Feb 23, 2022

f2 -f '((.*?))' -r '-'
INFO Failed to match any files

I don't know what I am doing wrong here

@ayoisaiah
Copy link
Owner

You're not including the backslash:

$ f2 -f '\((.*?)\)' -r '-'

@zz0rk
Copy link
Author

zz0rk commented Feb 23, 2022

I've been copying and pasting the command directly from your comment into my terminal and also typed it manually. Same result.
image

I have noticed that when I preview this comment the backslash gets removed, so in fact the syntax I've been using was correct, but didn't pay attention that when the comment get's posted the backslash gets removed.

@ayoisaiah ayoisaiah reopened this Feb 23, 2022
@ayoisaiah
Copy link
Owner

@zz0rk That's weird, I'm unable to reproduce. What version of f2 are you using?

@zz0rk
Copy link
Author

zz0rk commented Feb 23, 2022

I am running a current version of Debian 11. I've tested on a second box and I am getting the same results. I can upgrade to the latest version of F2 later today, but the version I am running right now doesn't work.

image

@zz0rk
Copy link
Author

zz0rk commented Feb 23, 2022

Curiosity got the better of me... still no dice
image

@ayoisaiah
Copy link
Owner

I just tested on Debian 11, same result for me. Are you using bash or some other shell?

image

@zz0rk
Copy link
Author

zz0rk commented Feb 24, 2022

Man, this is weird. I don't have anything fancy.
image
image

@ayoisaiah
Copy link
Owner

I'm going to close this issue, because I couldn't reproduce it on of my setups.

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

No branches or pull requests

2 participants