Pattern Matching in C 
Author Message
 Pattern Matching in C

Hi

I am looking for Pattern Matching in C.

bool IsMatch(char* szStr, char* szPattern)

where szPattern can be "[a-z][0-9]*?".  

The example he gave was something like:

bool IsMatch("This is a string", "This*st?ing")
would return true.

"badbadbadbad"
"bad*d"

should return true.

Can any one help me

-TIA



Fri, 30 Sep 2005 03:13:56 GMT  
 Pattern Matching in C


Quote:
> Hi

> I am looking for Pattern Matching in C.

> bool IsMatch(char* szStr, char* szPattern)

> where szPattern can be "[a-z][0-9]*?".

> The example he gave was something like:

> bool IsMatch("This is a string", "This*st?ing")
> would return true.

> "badbadbadbad"
> "bad*d"

> should return true.

> Can any one help me

> -TIA

You should take a look at the regex function. Its not a part of the ANSI
standard though. YOu can find it in the POSIX libraries.

--
-Ashish
--------------------------------------------------------------------------
Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!
http://www.123ashish.com



Wed, 28 Sep 2005 02:41:54 GMT  
 Pattern Matching in C

Quote:

> I am looking for Pattern Matching in C.

> bool IsMatch(char* szStr, char* szPattern)

> Can any one help me

You need to decide whether you want a regular expression parser or a
wildcard matcher. The regular expression parser is found in many Unix
installations, and utilities like grep, whilst the wildcard matcher is what
DOS used to use to match filenames.
A wildcard matcher is easier to write, easier to use, and almost as useful
as a regular expression parser, but it isn't as powerful.
Wildcards are '*' (match any characters or none) and '?' (match a single
character). The '*' is the hard part to handle, and you also need special
cases like "*?" (match at least one character).


Fri, 30 Sep 2005 05:21:43 GMT  
 Pattern Matching in C

Quote:


>>I am looking for Pattern Matching in C.
>>bool IsMatch(char* szStr, char* szPattern)
>>Can any one help me
> You need to decide whether you want a regular expression parser or a
> wildcard matcher.

Wildcard matchers have been explored extensively on clc in the past 6-8 months.
Check google/groups for wildcard, match, etc.

/david

--
fortran was the language of choice
for the same reason that three-legged races are popular.
        -- Ken Thompson, "Reflections on Trusting Trust"



Fri, 30 Sep 2005 07:47:53 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Regular Expressions/Pattern Matching/Unordered pattern

2. Pattern Matching in C -

3. Pattern Matching Tool

4. Help, Pattern used in Regex.Matches(...)

5. pattern matching and string replacement

6. help with a fast pattern matching utility requested

7. Pattern Matching in execution time

8. pattern matching with the function glob.

9. Performance while regexp pattern matching

10. pattern matching in c

11. HTML scraping (WSDL HTML pattern matching)

12. Request for Sample Code in case sensitive pattern matching of string in C

 

 
Powered by phpBB® Forum Software