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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:15:15+00:00 2026-05-24T02:15:15+00:00

I am trying to find record with names which have non-alpha numeric characters. I

  • 0

I am trying to find record with names which have non-alpha numeric characters.

I thought that I could do it with REGEXP

http://dev.mysql.com/doc/refman/5.1/en/regexp.html

Then I referred another SO question

How can I find non-ASCII characters in MySQL?

I found I could use this query :

SELECT * FROM tableName WHERE NOT columnToCheck REGEXP '[A-Za-z0-9]';

But it returns me zero rows . If I replaced the command to :

SELECT * FROM tableName WHERE columnToCheck REGEXP '[A-Za-z0-9]';

It returns me all the rows!!.

I tried some basic commands :

SELECT 'justffalnums' REGEXP '[[:alnum:]]'; returns 1

which is correct but

SELECT 'justff?alnums ' REGEXP '[[:alnum:]]'; also returns 1

I don’t understand why it returs one. It should return 0 as it has space and also a ‘?’ .

Is there anything to be enable in mysql for the regexp to work ?

I am using mysql 5.0 and tried with 5.1 too .

  • 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-24T02:15:17+00:00Added an answer on May 24, 2026 at 2:15 am

    You need to add ^ (string begins) and $ (string ends) as well as an operator saying a certain number of alphanum’s to use. Below I used + which means one or more.

    SELECT 'justff?alnums ' REGEXP '^[[:alnum:]]+$';
    -- only contains alphanumns => 0
    
    SELECT 'justff?alnums ' REGEXP '^[[:alnum:]]+';
    -- just begins with alphanum => 1
    
    SELECT 'justff?alnums ' REGEXP '[[:alnum:]]+$';
    -- just ends with alphanum => 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying write a query to find records which don't have a matching record
Im trying to find records in a VARCHAR column that may contain a NUL
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Trying to find the sqlserver adapter for rails on windows. I have tried getting
Trying to find an example that has css rollover using sprites & sliding door
I'm trying to connect to multiple databases in castle active record (which uses nhibernate.)
I'm trying to find all the distinct 'widget' names in my color table where
What I am trying to do is find out which fields were updated and
Am I doing this right? I am trying to find all the changes that
I'm trying to model a user which could be invited by another user. So

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.