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
Can regular expression be used in Conditional Expressions? Any string functions available? #959
Comments
This isn't currently possible, but I think it would be a useful feature. I would propose adding it as a new conditional form, probably something like:
Where |
Thanks!
In my case, it is used to handle the parameters given, which may vary a little in different running. I think it is a need, and is a common in sh or Python scripts.
|
I need this feature, too. Thx |
Implemented in #970! I'll try to cut a release soon, but for now it's available on master on GitHub. The operator is foo := if "hello" =~ 'hel+o' { "match" } else { "mismatch" }
bar:
@echo {{foo}}
|
I just published 0.10.2, which includes regular expression conditionals. Prebuilt binaries should be available soon on the releases page. Sorry for the delay! I was on vacation 🙇♂️ |
good job!
|
I want to test whether a sub-string (such as "GPU") is contained in a parameter or values.
I tried if "GPUS" == "GPU", which can work in the shell and return the 'true' value.
The text was updated successfully, but these errors were encountered: