Jump to content

Regex : better solution than ^[0-9]+(,[0-9]+)*$ ?


phdphd
Go to solution Solved by Jacques1,

Recommended Posts

Hi All,

 

I have a preg_match that checks if a string is made up of a number, or of a comma-separated list of numbers. The regex is :

^[0-9]+(,[0-9]+)*$

When the form is processed, the browser crashes if the string is very long. (It does not if I just do not run the preg_match).

 

I guess the solution might be adjusting the pcre.backtrack_limit setting. However I would like to know if there is a better solution than the above preg_match to check the string.

 

Thanks.

Link to comment
Share on other sites

  • 7 months later...
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.