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 7585989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:18:44+00:00 2026-05-30T19:18:44+00:00

Using the POSIX character classes How to match [:cntrl:] but excluding the [:space:]? $message

  • 0

Using the POSIX character classes

How to match [:cntrl:] but excluding the [:space:]?

$message =  ereg_replace("[[:cntrl:]]", "", $message);
  • 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-30T19:18:46+00:00Added an answer on May 30, 2026 at 7:18 pm

    ereg_* (POSIX) functions have been deprecated for a long time now. You should not contiue using these methods.

    According to POSIX Bracket Expressions [:cntrl:] resolves to the ASCII range [\x00-\x1F\x7F] (or the unicode \p{Cc}) and [:space:] resolves to [ \t\r\n\v\f]. Using asciitable.com to resolve those characters, you are left with an exclusion list of [\x20\x09-\x0D]. “Doing the math” you are left with [\x00-\x08\x0E-\x1F\x7F]. and that leaves you with the following, PHP 5.3 and upward compatible, sanitization:

    $message = preg_replace('/[\x00-\x08\x0E-\x1F\x7F]+/', '', $message);
    

    Note that VT (Vertical Tab) and FF (Form Feed, New page) are also preserved. Depending on your situation you might want to remove these, too:

    $message = preg_replace('/[\x00-\x08\x0E-\x1F\x7F\x0A\x0C]+/', '', $message);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to match a 32 character hex string using gawk. I've found that
I have encountered some strange Perl behavior: using a Posix character class in a
Using POSIX threads & C++, I have an Insert operation which can only be
I built a client server application using posix shared memory and posix unnamed semaphores
I'm trying to build a client server application using POSIX shared memory and POSIX
When using a POSIX shell, the following touch {quick,man,strong}ly expands to touch quickly manly
I'm trying to extract a string from another using regex. I'm using the POSIX
What are the trade-offs between using a System V and a Posix semaphore?
Specifically, I'm using the Linux command: $ find . -regextype posix-extended -regex '<some regex>'
I have question regarding shared memory segmentation in c using POSIX system calls. Is

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.