[Boost-users] Regex: option for case insensitive match

146 views
Skip to first unread message

Kiran Reddy

unread,
Aug 11, 2005, 6:29:08 AM8/11/05
to boost...@lists.boost.org
Hello,

I need to make an case insensitive match using regex_match()
algorithm. How do I specify that?

Thanks in advance.

Regards
Kiran

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Detlef Meyer-Eltz

unread,
Aug 11, 2005, 11:17:22 AM8/11/05
to Kiran Reddy

set icase for the syntax options of your regex:

boost::regex_constants::syntax_option_type f = boost::regex_constants::normal;
f |= boost::regex_constants::icase;
boost::regex expr("123", f);


--
mailto:Meyer...@t-online.de

url: http://www.texttransformer.de
url: http://www.texttransformer.com

--


am Donnerstag, 11. August 2005 um 12:29 schrieben Sie:

John Maddock

unread,
Aug 11, 2005, 11:35:49 AM8/11/05
to boost...@lists.boost.org
> I need to make an case insensitive match using regex_match()
> algorithm. How do I specify that?

You do it when you construct the regex, so for example:

boost::regex re("abc", boost::regex::perl | boost::regex::icase); // a case
insensitive Perl style expression.

John.
Reply all
Reply to author
Forward
0 new messages