GithubHelp home page GithubHelp logo

Comments (5)

Chikashi-Kato avatar Chikashi-Kato commented on June 30, 2024 1

Yeah, it makes sense :) We should flip the result of the evaluation if the negate option is specified :)

from slacktee.

Chikashi-Kato avatar Chikashi-Kato commented on June 30, 2024

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.

connorjclark avatar connorjclark commented on June 30, 2024

^[^(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.

Chikashi-Kato avatar Chikashi-Kato commented on June 30, 2024

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.

J0WI avatar J0WI commented on June 30, 2024

How about negating the condition, like if ! [[ $line =~ ${cond_prefix_patterns[$i]} ]]?

from slacktee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.