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

dropdown box help - open php files to textarea
Hi, I am using tinymce to edit content located in several php files. The code I attached works but i

PHP and Javascript
Hi Guys,

Im trying to load the contents of an html file into a text area for editing, this is

data type in column definition
I create a table with column called "Direction of Travel code ".
The travel codes in t

why preg_match_all does not return the number of matches
My regex looks like


(where X and Y are two Chinese characters)

Problem with creating FI documents
Hi, Experts!

when i create Fi doc. with standart transaction, i ve been had such problem

unoconv doc convert to pdf code prob

Hi. I am trying to use this code to convert docs to .pdf utilizing unoconv. Howe

Stumped by Third Day of Month problem
I am trying to build an algorithm that will essentially do this:
Code: [Select]$this_month = Oct

Hi all,

I am seeking reading note on the following in BW


Date/Time and Checkbox
Hi Everyone,

I am trying to figure out how to insert the current date and tim

writing my own sobel filter convolution - something is wrong
I am trying to keep it very simple, I cant see anything wrong with my logic, could anybody help poin

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