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

Using cURL to PUT
Can somebody help with the correct php code to make a cURL PUT request. Here is a sample of code bel

DB2 for z/OS, LUW, iSeries
Hello, In this forum a lot of threads related to other members of the DB2 family than DB2 for z/OS

Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue.

I have a banner s

Display thumbnails as square while retaining aspect ratio
I am trying to figure out a way to make an image display as a square, for example 80x80 pixels, when

with clause
hi all, i have a big query that usually access the same table more than once. for example, i have s

calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same

Transaction variant for VA02 not working
My requirement is to have transaction for user to only add the output and print a sales order.

grouping within a foreach?
hello all,

I currently have a list of products spit out from my db via a foreach loop. Right

"GROUP BY" in arrays
Well i'm looking to do something i usually could do easily using COUNT and GROUP BY if it was a sql

how to load a Sys file with system load and call images?
normally you need register the module as a service with CreateService, and start the service

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