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

Add support for non-regex processing #115

Open
ghost opened this issue Jul 13, 2021 · 0 comments
Open

Add support for non-regex processing #115

ghost opened this issue Jul 13, 2021 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ghost
Copy link

ghost commented Jul 13, 2021

Currently, pywhat only uses regular expressions to identify stuff. However, we may often want to update the description based on a match or to filter out false positives.

Some examples:

  • Pinging URLs to check if it is responding or if a certain resource exists, etc.
  • Parsing timestamps ([Proposal] parse timestamps #234) (1637093119.558717 to November 16, 2021 8:05:19 PM)
  • Changing rarity based on a match
  • And many more

How it should be implemented?

I think the best idea would be to write a class for every regex pattern (so that it can save the state between several matches). That class should have a method like process() that gets a match object and can alter it and return it or return None to filter it out.

Example:

class URLProcessor:
    def process(match):
        if "http://trashurl.it" in match["url"]: # Or maybe we should create an actual Match class and do match.url
            return None
@ghost ghost mentioned this issue Nov 17, 2021
@ghost ghost changed the title Add non-regex checkers for certain regexes Add support for non-regex processing Nov 20, 2021
@ghost ghost added enhancement New feature or request help wanted Extra attention is needed labels Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

0 participants