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

Socket problem
Hello,

Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.

regex for quoted text within a string
I am still getting the hang of regex expressions, but I cant seem to figure out how I would escape q

How to sum these output values
Hi

I need sum the month totals
SELECT region_name, area_name ,SUM (CASE WHEN S

login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php

PHP switch function help
Hi, I am trying to create a search function for a directory website. On the search function on html

Need help with cin setw
I made a program here is my code:

#include
#include
#i

Website Direction...
I recently used this code to try and make it so the page loads as http://www.domain.com/ when you ty

Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :

XML Grouping
I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, h

Return X values where an ID number doesnt matter
Well as for subject heading, thats the best i could think of.

Currently im having a problem w

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