Skip to content

RyanSinfield/StringQueryTool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

StringQueryTool

Matches a string against a predefined query. Allows for and/or operators and brackets to modify the order of operations.

Example usage:

from StringQueryTool import *

if __name__ == "__main__":
    qt = StringQueryTool("(this&that),(the&rest)")
    test = []
    test.append("this and that")                      # true
    test.append("this and the rest")                  # true
    test.append("that and this")                      # true
    test.append("that and the rest")                  # true
    test.append("this and that and the rest")         # true
    test.append("this and rest")                      # false
    test.append("this")                               # false
    test.append("that")                               # false
    test.append("the")                                # false
    test.append("rest")                               # false

    for i in test:
        print("Testing: %s" %i)
        print(qt.is_match(i))

is_match returns true for any strings that match the specified pattern. In the example, strings will evaluate to true if they contain either "this" and "that", or "the" and "rest".

About

Allows for complex queries against strings in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages