why preg_match_all does not return the number of matches


Posted on 16th Feb 2014 07:03 pm by admin

My regex looks like

X[^x{4e00}-x{9fa5}]*Y

(where X and Y are two Chinese characters)

and my expression looks like

preg_match_all("/".$regex."/iu", $content, $out, PREG_PATTERN_ORDER)

it turns out that preg_match_all is always returning 1, even though count($out[0]) is > 1 (and correctly so). So I ended up using count($out[0]) rather than the value this function returns. Though this solves the current issue I need, I am very curious why this is happening. Am I misunderstanding preg_match_all?

I'd greatly appreciate if anyone can point me to the explanation of this problem. Thanks in advance!

No comments posted yet

Your Answer:

Login to answer
333 Like 22 Dislike
Previous forums Next forums
Other forums

ldap connection
We are using ldap to get user information from the domain controller. It was working before. Recentl

An odd assignment statement. Can someone explain this assignment to me?
What purpose is served by the bit of code between the two equal signs in the $installurl set? Is th

Multi image upload
I have a gallery to build and want to build a dynamic upload form to allow for $var number of fields

upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t

Add 5 to a variable when a button is clicked, and re-run a for loop
So I'm making a feedback sort of section on a website with MySQL and PHP, I've gotten the script to

CURL question
i am wondering if it's possible to use multi curl with login something like

login once to web

Validating time
Hi Guys

what do you think of the following approach to validate a 24hour time:

http://

Add User script "Could not execute query"
This should be an easy script but I can't get it to run. Can someone please help me?

<

Filename like the user name
I am creating a form and storing the values in file. Could anyone please tell me how to write a code

Something like an INI editor or a DelimitedText-Editor
Hi all,

Am very, very, very new to PHP and not sure if I should be posting this to a Javascri

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