Regex VERY IMPORTANT!!!!

Can someone pls provide a sample program which makes use of the regex library?I want a function which does pattern matching for numbers, which library does that?Regex or Boost Regex?
Last edited on
I would prefer if someone posted a simple program that uses the regex library, its easier to understand than going through lots of details online.
Go to the Introduction and Overview section in the link above. Learning how to use a library requires a little reading on your part.

Here are some test programs:
http://www.boost.org/doc/libs/1_33_1/libs/regex/doc/examples.html
Last edited on
Here's how use regex lib.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <regex>
using namespace std;

int main()
{
	string str = "Hello World"; 
	tr1::regex rx("ello");

	bool rv = regex_match(str.begin(), str.end(), rx);

	rv == true ? cout << "Found match" << endl : cout << "Not a match" << endl;
	return 0;
}
Topic archived. No new replies allowed.