+2  A: 

No - you need boost::regex

pm100
+4  A: 

Use Boost.Regex

Alexey Malistov
What about Boost.Xpressive?(I have no idea what is it,but googling pop it up).
Arman
@Arman: I would go with Boost.Regex, since the C++0x draft regex is based on it
stephan
@Stephan: Is that means that in the nearfuture I will be able to change boost::regex to std::tr1::regex or something like that?
Arman
@Arman: str::tr1::regex is alread part of gcc and MSVC 2008 as a feature pack. In the future, it will be just `include <regex>` if IIRC.
stephan
@Stephan: Unfortunately feature pack does not support MSVC2008 Express.
Arman
@Arman: uh, didn't know about that "feature" :-(. Then use Boost and wait (MSVC 2010 moves TR1 into the std namespace).
stephan
@Stephan: Well MS keeps nice things inside the commercial products.BTW, I just discovered that MSVC2010 Betta Express includes PPL and TR1 headers.
Arman
A: 

Regular expressions were made for this sort of thing. I can understand your reluctance to avoid a dependency, but in this case it's probably justified.

You might check your C++ compiler to see if it includes any built-in regular expression library. For example, Microsoft includes CAtlRegExp.

Barring that, your problem doesn't look too difficult to write custom code for.

Mark Ransom
@Mark:Thank you for answer. Actually the code is platform independent. currently it is using several strcmps but that way is nonextensible.
Arman
A: 

You can do it without introducing a new library dependency, but to do so you'd end up writing a regular expression engine yourself (or at least a subset of one).

Is there some reason you don't want to use a library for this?

Joe Gauterin
@Joe: Yes, you are right, seems to me I need to include Boost.Regex here. The code is pure C++/STL, and it is portable. Sometimes on different machines there is no BOOST installed.
Arman
If you need compilability on machines without boost, you could extract the boost regex headers and source and integrate them directly into your project. I think I remember seeing discussion of doing that on the boost users mailing list at some point.
Joe Gauterin
Yes, thats true, this is the bcp tool.
Arman