Boost logo

Boost Users :

Subject: Re: [Boost-users] String algorithm? Removing non-alphanumerics from a string
From: Tim Burgess (tim_at_[hidden])
Date: 2013-10-19 17:38:51


Many thanks for this - I'll give it a spin.

Best wishes.

Tim Burgess

-----Original Message-----
From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
Bjorn Reese
Sent: 19 October 2013 12:03
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] String algorithm? Removing non-alphanumerics from
a string

On 10/18/2013 08:05 PM, Tim Burgess wrote:

> Takeing an std::string as input, I need to return the same string with
> any characters not in the ranges "az", "AZ" and "09" being discarded. A

#include <boost/regex.hpp>
#include <boost/algorithm/string/regex.hpp>

// ...

     boost::regex non_alnum("[^[:alnum:]]");
     boost::algorithm::erase_all_regex(input, non_alnum);

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net