Jump to content

PHP regular expressions


menwn

Recommended Posts

Hello all,

 

My question is this. How can one with a regular expression to guarantee that at least on digits exists in a string.

 

Valid Example: ABdafd123

 

Invalid Example: ABCfgssf

 

Thank you

 

Link to comment
Share on other sites

Thank you for your reply.

 

I want to disable the ability to pass not alphanumeric characters. And this does not help a lot.

 

Up to now I had: preg_match("/[^a-zA-Zα-ωΑ-Ω0-9]/", $text)

 

It works ok but I can pass all letter strings which I want to forbid unless it has at least a digit in it.

 

thanks

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.