How do you tell if two wildcards overlap?

Posted by Tom Ritter on Stack Overflow See other posts from Stack Overflow or by Tom Ritter
Published on 2010-05-12T18:05:37Z Indexed on 2010/05/14 19:04 UTC
Read the original article Hit count: 282

Given two strings with * wildcards, I would like to know if a string could be created that would match both.

For example, these two are a simple case of overlap:

  1. Hello*World
  2. Hel*

But so are all of these:

  1. *.csv
  2. reports*.csv
  3. reportsdump.csv

Is there an algorithm published for doing this? Or perhaps a utility function in Windows or a library I might be able to call or copy?

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about wildcard