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

seemingly regex non-capturing group is not supported? #38

Closed
mo-han opened this issue Feb 5, 2023 · 5 comments
Closed

seemingly regex non-capturing group is not supported? #38

mo-han opened this issue Feb 5, 2023 · 5 comments

Comments

@mo-han
Copy link

mo-han commented Feb 5, 2023

No description provided.

@ayoisaiah
Copy link
Owner

@mo-han You mean like this?
image

@mo-han
Copy link
Author

mo-han commented Feb 8, 2023

you are correct. but i'm still confused by this:

command line:
f2 -f "(.+ (\d{4}-\d\d-\d\d) (\d+)(?:_p\d+) (.+) @.+)" -r "$2 $3 $4 @/$1"

filenames example:

pixiv 2015-03-28 49517590 尻 @ひきとぐ 49517590_p0.jpg
pixiv 2015-03-28 49517590_p0 尻 @ひきとぐ 49517590_p0.jpg

the (?:_p\d+) part mismatch the first one, but it should match both, or not?

(anyway it's probably not issue of f2, but i'm just very confused)

@ayoisaiah
Copy link
Owner

@mo-han You need a question mark after the (?:_p\d+) part to indicate that its optional:

image

@mo-han
Copy link
Author

mo-han commented Feb 9, 2023

I've totally misunderstood this syntax. Thank you!

@mo-han mo-han closed this as completed Feb 9, 2023
@ayoisaiah
Copy link
Owner

Happens to us all :)

Would recommend using https://regex101.com/ to debug your regex. Just make sure to select the Golang variant in the sidebar

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