Post Reply 
(71B) Wildcard pattern matching, directory listing
04-16-2021, 07:35 PM
Post: #2
RE: (71B) Wildcard pattern matching, directory listing
(04-16-2021 02:49 PM)Dave Britten Wrote:  The algorithm is relatively simple. It compares the input string to the pattern one character at a time. A ? in the pattern is automatically considered a match against the current character. If * is encountered, it moves the pointer in the pattern to the next character, and starts recursively calling the matching function (FNM), incrementing the pointer to the input string one character at a time until it either finds a match or gives up.

Recursion is not needed and can result in exponential blow-up of the matching time. For details see my Code Project post why blow-up happens and how to optimize to match * and ? wildcards and [a-z] ranges efficiently. Hope this helps!

- Rob

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (71B) Wildcard pattern matching, directory listing - robve - 04-16-2021 07:35 PM



User(s) browsing this thread: 3 Guest(s)