المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : text pattern matching(wildcard)



C++ Programming
08-20-2009, 01:10 AM
Hi all,

I tried to make an matching between two strings the first is Pattern(" * weather * ") and the second is the user's input like User_str("how is the weather in London?"), so these two strings matched as follows:

the first star * = "how is the"
weather = "weather"
And the second star * = "in London?"

The function should return true if matched and false if not.

I know the idea of this function its an old but I have to build it from scratch(without using regular expressions) for unicode strings with these restrictions

the * if its attached to the text(ex. weather) should match zero or more characters.
the * if its not attached to the text (ex. weather) should match one or more characters.
the ? should match only one character whatever where it is.

If anybody have an idea please let me know because i had some trials but my function is not working properly.


Thanks alot