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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:21:02+00:00 2026-06-14T08:21:02+00:00

This thing really confuses me, pardon my ignorance. I have a var $name in

  • 0

This thing really confuses me, pardon my ignorance.

I have a var $name in here that I want to be free from number, I don’t want any digit to be included in it. My preg_match() is this:

var_dump(preg_match('/[^\d]/',$name));

Test cases:

$name = "213131"; // int(0) 
$name = "asdda"; // int(1)
$name = "as232dda"; // int(1)

What I want is to have the third case to be int(0) too.

I’m really a hard time understanding this preg_match(), docs say it return 1 if a pattern match a subject. Here in my case, I use a negated class.

  • 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-14T08:21:03+00:00Added an answer on June 14, 2026 at 8:21 am

    #3 matches because you have both letters and numbers. Your regex in English basically says

    it matches if there is a non-digit character

    If you want to match only non-digit characters, you have to have the regex match against the entire string and allow for an arbitrary number of characters:

    ^[^\d]+$
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i didn't really know how to title this question, but here's a thing that
I`m really confused here about this weird behavior! The thing is, I have a
I've been having this really annoying thing happen the past few days, that has
Okay, this behavior has me really stumped. I have an IQueryable list that I'm
This really confuses me, I think I'm stupid but I've searched and have done
I'm really confused with this whole measuring thing that android does for layouts. Basically,
A really weird thing happens in this code JNIEXPORT jintArray JNICALL Java_jsdr_SdrLibrary_getTunerGains (JNIEnv *
I'm sure this is a really simple thing, but I haven't worked in C++
This is for an iPhone App, but I don't think that really matters. I
I've been making websites for years and theres on thing that really bugs me

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.