Click here to Skip to main content
15,885,767 members
Articles / Programming Languages / Python

Fast String Matching with Wildcards, Globs, and Gitignore-Style Globs - How Not to Blow it Up

Rate me:
Please Sign up or sign in to vote.
4.99/5 (44 votes)
22 Jul 2023CPOL11 min read 41.6K   1.3K   59  
Classic globbing and modern gitignore-style globbing algorithms can be fast, whereas recursive implementations are known to blow up exponentially; why some freely available source code should not be used.
This article discusses the implementation of wildcard matching, classic globbing, and modern gitignore-style globbing algorithms using star-loop iterations instead of recursion. The algorithms are efficient, typically running in linear time, and avoid exponential blow-up in CPU usage for worst-case scenarios.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO
United States United States
Founder of Genivia inc, Professor of Computer Science

Comments and Discussions