|
Boost Users : |
Subject: Re: [Boost-users] regex_replace
From: Mauricio Gomes (mgpensar_at_[hidden])
Date: 2012-02-06 08:59:46
I am not an expert in Regex but try to substitute the commas between the
parenthesis by \. (backslash dot), escaping the dot.
regex_ip(".+\\(([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\\).*");
Note: I have not tested it.
Hope this helps,
Mau.
On Mon, Feb 6, 2012 at 11:47 AM, Christer Borgqvist <
christer.borgqvist10_at_[hidden]> wrote:
> Hi
>
> I have a problem with the following
> std::string stmp = "PORT (127,0,0,1,6,56)\r";
> cout << stmp << endl;
> boost::regex
>
> regex_ip(".+\\(([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,})\\).*");
>
> std::string sip = boost::regex_replace(stmp, regex_ip, "$1.$2.$3.$4",
> boost::format_all);
>
> output is 127.0.0.1
> if I change to this stmp = "PORT 127,0,0,1,6,56\r";// remove the '('
> and' )'
> the output is 127,0,0,1
> what do I have to change in the boost::regex regex_ip to get 127.0.0.1 dots
> instead of comma
>
> appreciate any help
> Christer
>
>
>
> _______________________________________________
> 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