Find occurences of unicode characters in string


Posted on 16th Feb 2014 07:03 pm by admin

I need to prohibit filenames with everything but English characters and numbers but regexp and string function don't seem to work because they consider the Greek alphabet letters as part of the A-Z a-z sequence. Here's what I've tried:

Quote:if (strspn($str, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") != strlen($str))
{
echo 'invalid filename';
}

Quote:if (!preg_match("/^([-a-z0-9])+$/i", $str))
{
echo 'invalid filename';
}

No comments posted yet

Your Answer:

Login to answer
316 Like 17 Dislike
Previous forums Next forums
Other forums

Php - mysql select?
hi, i have this code:

Code: <?php
session_start();
// dBase file
include &quo

Serial number of exernal hard disk/Thumbdrive
Hi guys, I am new tio java networking concepts.Please tel me how to get Serial number of exernal

Code Review - SQL and Insertion Attacks (Warning: Not for Newbs)
Hey guys,

Its been a while, I know. Use to love coming here to answer peoples questions, but

array_count_values question?
ok i'm trying to create a top ten list from a database of listed favorite movies.

the followi

how to get values from $_Post with onchange="form.submit();"?
Hi, I have a form that submit to itself with a file upload field and two other hidden field values.<

need to apply an if/else statement to Tim Thumb script
Not sure how to work this. I essentially want to call a variety of image sizes based on which style

Passing PHP variables from one page to another
Hello-

I'm having trouble figuring out how to transport a variable from one php file to anoth

user administration
Dear @all,

what I have to do to set the user defaults for new users. At the moment I woul

mails going in spam??
The mails I sent to folks in my database using mail(function) are going in spam??

Any idea ho

POST into Array problem
Hi Chaps,

I have a repeat region, displaying rows of data: jobid, fromtable, translatorcharge

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash