Comments (5)
Yeah, it makes sense :) We should flip the result of the evaluation if the negate option is specified :)
from slacktee.
Hello, thank you for submitting the enhancement idea. I think it's useful for the case which uses complicated regex pattern. For the simple case (like your example), we can use negated character class.
./slacktee.sh -c "chuck_test" -n -a "good" -o "danger" "^[^(Success)]" -d "@channel" "^[^(Success)]" -m link_names
I am not 100% sure if ^[^(Success)]
is a correct regex pattern, but it works like a charm as far as I hav e tested ;p
from slacktee.
^[^(Success)]
Unfortunately that "negated" regex works by accident. Any character in brackets are interpreted directly, except for dashes for denoting ranges and an anchor to negate the character class, AFAIK. So group capturing does not work. See this.
A negative lookaround will work.
^(?!Success)
Anyways, a negate option would be useful! Thank you for the suggestion. Would you like to give a shot at an implementation?
from slacktee.
Hi Connor, thank you for checking it! Yeah, I checked ^[^(Success)]
with multiple regex parser, but none of them worked like Bash's regex operator (=~
) which slacktee is using.
I also tried to use negative lookaround, but it didn't work with Bash's regex operator. Seems like the implementation of Bash's regex operator is kinda unique ;p
Here is the one I have tried.
./slacktee.sh -c "chuck_test" -n -a "good" -o "danger" '^(?!Success)' -d "@channel" '^(?!Success)' -m link_names
I would love to have the negate option, but I am not sure I can quickly find enough time to implement it by myself (it should be super easy to implement, though). It would be really appreciated if anyone can implement it and submit PR!
from slacktee.
How about negating the condition, like if ! [[ $line =~ ${cond_prefix_patterns[$i]} ]]
?
from slacktee.
Related Issues (20)
- Error: here-document delimited by end-of-file (wanted `EOF') HOT 3
- color doesn't stay HOT 3
- Unable to close with CTRL+C, when running directly HOT 4
- Interactive copies won't work for unattended installs HOT 2
- Using Webhook to run slacktee HOT 2
- Unable to create slacktee as a service HOT 4
- Add ability to skip interactive setup upon installation HOT 2
- "not in channel" error HOT 10
- Different output by same bot? HOT 3
- invalid json when sending non-json text HOT 14
- Globbing HOT 7
- Post to thread HOT 1
- Color in ouput gives json error HOT 4
- Breaking rich format when sending +4000 characters HOT 2
- Add version flag HOT 1
- Send without message
- `parseMode` causes invalid json error
- streaming but without editing
- any kind of logs?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slacktee.