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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:09:06+00:00 2026-06-02T12:09:06+00:00

I have a quick regex question that I figured someone might know off the

  • 0

I have a quick regex question that I figured someone might know off the top of their head. What would the regex be for CakePHP’s validation be if I only want to allow upper/lower alphanumber, spaces, punctuation, and quotes? This is what I have, but it’s off:

 'rule' => array('custom', '/[a-z0-9\x20\x21\x2E\x3A\x3B\x3F\x2C\x27\x22]{0,600}/i'),

From what I get, the a-z0-9 covers alphanumeric, but shouldn’t the \xXX cover the punctuation with the ASCII hex codes? And then the {0,600] means a length of 0-600 characters, and i means upper and lower. What am I missing?

For example: valid: This is a “valid text”, which contains ‘ and punctuation!

invalid: This is an obvious XSS attempt

  • 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-02T12:09:08+00:00Added an answer on June 2, 2026 at 12:09 pm
    ^([\d\w\s?!\.;:,'"\/\[\]\(\)=\+-]*)$
    

    should work? You should provide examples of what texts you consider to be valid and which are invalid.

    preg_match('/^([\d\w\s?!\.;:,'"\/\[\]\(\)=\+-]*)$/', $string);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick regex question (since i am horrible at it) I have a field that
I had a quick question regarding RegEx... I have a string that looks something
Just a quick regex question...hopefully I have a string that looks something like this:
A quick simple regex question I have a domain name in a string that
I have a quick question that I can't find anywhere. I am limiting my
I have two quick question with regex with grep. what does \? mean? I
just a quick question am abit rubish with regex so thought I would post
I have quick question for you SQL gurus. I have existing tables without primary
I have a quick question about fetching results from a weakly typed cursor and
I have a quick question about encapsulating specific types with typedef . Say I

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.