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

  • SEARCH
  • Home
  • 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 8997167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:51:07+00:00 2026-06-15T23:51:07+00:00

I expected to find this in SO already… but haven’t so far I’m talking

  • 0

I expected to find this in SO already… but haven’t so far

I’m talking about a regex which looks at an HTML ENCODED string: e.g. something like

blip ♦ trout’s mouth

Have I covered all the bases with &\w+; and &#[0-9]+;?

$encoded_string = htmlspecialchars($_GET["searchterms"]);
echo "<b>Search results for submitted string: \"$encoded_string\"</b><br><br>";
$html_special_chars_pattern = "!(&\\w+;|&#[0-9]+;)!";
$non_html_tokens = preg_split( $html_special_chars_pattern, $encoded_string, -1, PREG_SPLIT_DELIM_CAPTURE );
  • 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-06-15T23:51:08+00:00Added an answer on June 15, 2026 at 11:51 pm

    You are missing the &#xH; or &#XH; numeric character references.

    5.3.1 Numeric character references

    Numeric character references specify the code position of a character in the document character set. Numeric character references may take two forms:

    • The syntax "&#D;", where D is a decimal number, refers to the ISO 10646 decimal character number D.

    • The syntax "&#xH;" or "&#XH;", where H is a hexadecimal number, refers to the ISO 10646 hexadecimal character number H. Hexadecimal numbers in numeric character references are case-insensitive.

    That is, &#[xX][a-fA-F0-9]+; in regular expression.

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

Sidebar

Related Questions

Getting Expected ',' or '{' but found '#44559' error. My code looks like this:
I expected this to print [b] but it prints [] : $x = abc;
There have been several similar questions asked already but I couldn't find answer to
I've seen it happen a few times already but I can't seem to find
I've read most of the relevant answers on this topic already, but I can't
I expected to find XMLStreamReader to be AutoCloseable in Java 7. However, that is
I have a c99 function that uses openmp, which works as expected. I also
I've already realized some applications with a small graphical user interface. Nothing complex, but
Forgive me if this has already been asked elsewhere. I have a Scala syntax
I already solved this question, this Q&A is purely for future Googlers since it

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.