Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

String pattern matching (LIKE operator in SQL/VB)

Posted on 1999-06-30
4
Medium Priority
?
187 Views
Last Modified: 2008-03-03
I need some code to do simple string pattern matching in C++. something like the SQL/VB LIKE operator. I don't need all the options, * and ? is enough:

if(IsLike("fifl.com", "*.c??"))

Please give me full source code for the above procedure.
0
Comment
Question by:MikeP090797
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1198826
#include <regex.h>
regex_t re;
regmatch_t pmatch;
regcomp(&re,"^.*\\.c..$",0);
regexec(&re, fifl.com",(size_t) 0, &pmatch, 0);
0
 
LVL 8

Author Comment

by:MikeP090797
ID: 1198827
hmm, I couldn't find that header file. I'm using VC6..
0
 
LVL 23

Accepted Solution

by:
chensu earned 400 total points
ID: 1198828
0
 
LVL 8

Author Comment

by:MikeP090797
ID: 1198829
Thanks!
Exactly what I needed
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question