By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

Pattern matching with boost

P: n/a
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
Dec 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Mon, 12 Dec 2005 14:54:29 -0700 in comp.lang.c++, "Dave"
<be***********@yahoo.com> wrote,
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?
Dec 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.