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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:18:39+00:00 2026-05-29T05:18:39+00:00

I am editing an existing project, and there was a bug being reported that

  • 0

I am editing an existing project, and there was a bug being reported that the system doesn’t accept if the numeric comes first in the input, like 99% Creative. But if you’ll enter Creative 99%, the system accept it and save it in the database.

I check there existing code, and found out that they used this expression /^[\p{L}]+/u in preg_match. I googled over and found out to use \w but my senior wont accept my answer. He said its, unacceptable. This would give some issue.

Please check the script below, this is the one that i used:

$category= trim($_POST['category']);
if(preg_match('/\W/', $category)){
 $error='Invalid Input';
} 

He told me to test it, using some unicode character if it will accept like arabic texts, mixed (alphanumeric + arabic). It all works so it mean its fine but he still don’t accept it. He told me to formulate another regex expression.

Do you have any idea what should i do? What could be the expression i can use. I really don’t understand why \w is not acceptable.

  • 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-29T05:18:40+00:00Added an answer on May 29, 2026 at 5:18 am

    The PHP manual on PCRE escape sequences says that in PCRE the characters matched by \w depend on the locale (and \W is the negation of \w).

    This is unacceptable in a global environment, as you do not know the used server locale. What was the last setlocale() call? Is the site hosted in the U.S.A., in France, in China? You never know. And what might apply today, might not tomorrow. Users change, and sites do move.

    For example, your senior’s server might as well use a different locale than your server. So they could be right saying it does not work for them with certain characters that are not in their current locale.

    That is why they cannot accept your solution. You need to use Unicode character properties instead.

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

Sidebar

Related Questions

I want to add a row of headers to an existing CSV file, editing
When editing HTML in emacs, is there a way to automatically pretty-format a blob
I'm looking at using WMD in my project instead of my existing RadEditor. I
I've developed some concept code for a project that I will be working on
First off, the barest bones of the project I wish to create is a
I'm using Prototype in my Rails project to do in-place editing (via Ajax.InPlaceEditor) of
What is the best way to copy an existing KDevelop project folder to another
I have a large exiting C++ project involving: 4 applications 50+ libraries 20+ third
There are various ways of exiting a process: e.g.: ExitProcess, ExitThread (from the main
Editing a RichTextBox control's text (more specifically, modifying selection font/color) programmatically seems to be

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.