Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Q: Best way of matching strings?  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
An example of what I am trying to do is match a string such as lo?lip?p (the
?s are the missing letters in a crossword clue for example) to the words
which fit the blanks in a wordlist file.
How can you match a string (where there are wildcards) to another string? I
have looked at compareTo but I don't think that is the right way to do it.
The wordlist is implemented in a binary tree and, to search for matches, the
program does an inorder traversal
Can anyone offer any hints or URLs etc.
Donnie
 
paul wheaton
Trailboss
Posts: 22258
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your best bet is to go all the way and get a regular expression engine.
Try www.oroinc.com.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another very popular regexp package is GNU regexp. When the ORO software was unavailable for a while last year, this seemed to be generally regarded as the bast.
Frank.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!