Home » Categories » PHP » REGEX

PHP preg_match - only allow alphanumeric strings and - _ characters

if(preg_match('/[^a-z\s\d]/i', $line)) {
    $size_x -= 15;
}

 

 

Reference:

https://stackoverflow.com/questions/7753365/php-preg-match-only-allow-alphanumeric-strings-and-characters/46413055

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
 
Attachments Attachments
There are no attachments for this article.
Comments Comments
There are no comments for this article. Be the first to post a comment.
Related Articles RSS Feed
There are no related articles for this article.