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

Support %, %%, #, ## expansion #47

Open
pombredanne opened this issue Jun 28, 2021 · 4 comments · May be fixed by #48
Open

Support %, %%, #, ## expansion #47

pombredanne opened this issue Jun 28, 2021 · 4 comments · May be fixed by #48

Comments

@pombredanne
Copy link

It would be great if %, %%, #, ## expansions were supported
See https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

@sayanarijit
Copy link
Owner

sayanarijit commented Jun 28, 2021

Looks interesting, but pattern matching requires working with regex, which has different implementations in different programs. Definitely needs some research and probably implementation complexity too. Not sure if there's any use case worth the effort. I'll keep this issue open though.

@pombredanne
Copy link
Author

My use case is parsing m4, ebuild, PKGBUILD and APKBUILD files. Using the stdlib fnmatch is likely all you need and no re involved IMHO

sayanarijit added a commit that referenced this issue Jun 30, 2021
@sayanarijit sayanarijit linked a pull request Jun 30, 2021 that will close this issue
@sayanarijit
Copy link
Owner

I think we still need to deal with regex. For example, let's consider the string abcabbcd, and we want to match a*c.
# substitution should give us abbcd, and ## substitution should give us d.
But I couldn't find a straightforward way to achieve this with fnmatch. Let me know if you have any ideas.

@sayanarijit
Copy link
Owner

Worst case we'll need to try matching every possible combinations explicitly. I hope there's a better way.

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

Successfully merging a pull request may close this issue.

2 participants