Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:41:21+00:00 2026-05-24T02:41:21+00:00

Whe I had to create CMS in PHP I created simple unescape html function

  • 0

Whe I had to create CMS in PHP I created simple unescape html function that looked like this:

function unescape($s) {
    $s= preg_replace('/%u(....)/', '&#x$1;', $s);
    $s= preg_replace('/%(..)/', '&#x$1;', $s);
return $s;
}

How to translate it into C++ using Boost.Regex?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:41:21+00:00Added an answer on May 24, 2026 at 2:41 am

    I’d guess it would look a bit like this:

    std::string unescape(const std::string s)
    {
      std::string temp = boost::regex_replace(s, "%u(....)", "&#x$1;", boost::match_default);
      temp = boost::regex_replace(temp, "%u(..)", "&#x$1;", boost::match_default);
      return temp;
    }
    

    But I assume the . (DOT) should only match hexadecimal values, in which case I’d go for something like this instead:

    std::string unescape(const std::string s)
    {
      return boost::regex_replace(s, "%u([0-9a-fA-F]{2}|[0-9a-fA-F]{4})", "&#x$1;",
                                  boost::match_default);
    }
    

    (note that I did not test this!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that seems like its a result of a deadlock-situation. Whe
Whe I try to run my site locally I get this error: Description: The
I never understood this: in web development whe[ n|re ] does it make sense
Is there any way that i can cause mysql to be case sensitive whe
Is it possible to set a callback function that do something instead of returning
I have a data object used to contain my UI data that supports INotifyPropertyChanged
There are some constraints to this question; I don't have the ability to fundamentally
I have this very huge XML file of size 2.8GB. This is Polish Wikipedia's
I have a project that is built with native C++, as well as C++/CLI.
I have an ATL ActiveX control that raises three events (Connected, Authenticated, Disconnected) which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.