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))
{
Did you know?Explore Trending and Topic pages for more stories like this.
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

AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called throug

Is STL important?
I'm just starting programming and I've made it until the Standart Template Library. But the chapter

DELETE rows based on content
I have a link in my rows

$bit="http://bit.ly/abcd";
$query = mysql_query("D

Mysql error message
help me find out what this error message means:

"Duplicate entry '0' for key 'PRIMARY'&q

Why use interfaces in PHP (OOP)
I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't unders

Help pulling in 'id' with "read more" link
I'm trying to create snippets of my articles in the cms I'm creating, and then have them redirect to

PHP page is blank
Hi Everyone,

I have a site in which I am able to open the first PHP webpage in my browser but

onClick='location.href=index.htm'> not working
Below is my code:

echo "<input type='button' value='redirect' onClick='location.h

how to insert value
I am having file bookissueadd.php..... in which i am having tag

<td height="21&q

Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and ex

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