Pattern matching with boost

D

Dave

Hello all,

Using Boost (probably regular expressions), how would I check that a
std::string conforms to the pattern "Software Version:
[0-9]+-[0-9]+-[0-9]+-[0-9]+"? For example, the following string should be
accepted:

Software Version: 2-2-8-10

but this should not:

Software Version: 2-2-8-A

I'd like to do something akin to the following:

if (!boost::string_matches_pattern(str, "Software Version:
[0-9]+-[0-9]+-[0-9]+-[0-9]+"))
cout << "Bad software version!\n";

Thanks in advance,
Dave
 
D

David Harmon

On Mon, 12 Dec 2005 14:54:29 -0700 in comp.lang.c++, "Dave"
I'd like to do something akin to the following:

if (!boost::string_matches_pattern(str, "Software Version:

Where does that "string_matches_pattern" function come from?
Is it supposed to be another name for "regex_match" from the boost
regex package?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top