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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:15:51+00:00 2026-06-09T01:15:51+00:00

i need to check, if the string in my PHP code contains only a

  • 0

i need to check, if the string in my PHP code contains only a specified list of characters. But as some of them might need scape, i just can’t get it to work. I have tried everything, but it just doesen’t work…

The required validation is:

  • 0-9
  • A-Z
  • a-z
  • chars: .%^&()$#@!/-+/

Basicaly, i want to check if there is an unknown ascii character (i don’t know if there is a function to do that already).

My code is like this now:

if(preg_match("/[A-Za-z0-9\.\#\-\+\*\\\/\=\_\%\$\(\)]/", $cmd) === false)

So, all of the chars are special?

  • 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-09T01:15:53+00:00Added an answer on June 9, 2026 at 1:15 am

    You might be missing a * at the end of the regexp. Also you could instead have the set expressed like [\x00-\x7F] (taken from here).

    This should work:

    [\x00-\x7F]*
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to check whether a string contains any swear words. Following some advice
I need to check that a string takes on the format 05:31:2008:06:27:2010 I do
I need to check If a column value (string) in SQL server table starts
i need to check existing of Character (*,&,$) in Given String using python command
I need to know whether check whether a String end with something like .xyz
I need an simple way to check whether a string that is sent to
I need a function which will check for the existing URLs in a string.
In php is there a way i can check if a string includes a
i'm wondering how to check if a string like : http://www.reddit.com/xxx/x/xxx contains the word
I need your help., How to pass the array values in query string... <?php

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.