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

Preventing SQL Injection
I have a question about SQL Injection, In some of our code we use this: view plaincopy to clipboa

Word Trimming
Hi Guys & Gals!!

Hope you are all ok....

I need some help with the following

how to timeout $doc = new DOMDocument()->load($url)
I am currently using this $doc->load($url) to fetch an rss feed.
If a feed takes long than

article site help remaining text
Hi all hope you will be fine
I am creating a article site in this site i want to put some text on

Parse error: syntax error, unexpected $end in
hello,
i receive the error :Parse error: syntax error, unexpected $end in C:xamppxampphtdocsh

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

Search function
I am looking for some guidance from the experts.

I am trying to create a search function. It

Text to picture Generator
Hello, i have found this script and it works really good^^ But i have one problem, i would like to c

Most basic form question ever?
Hello,

I want to use this snippet to make sure the fields in a form are ok before processing

http to https
Hi,

Is there any specific method/condition to move an http:// page to https:// ?

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