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

array ...
hi
Code: function formatCategories($categories, $parentId)
{
// $navCat stores all child

PHP and SMS
Hi all forum members. I am new here and am unsure what category shoild I post this in.
Moderator

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

#include
#include
#i

PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a

What's wrong with my code
sobbing for many days, still don't know why please Help. Why my page isn't posted correctly. In a

need help with date function
i have following form for date

Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01

SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign

Getting a variable to work in function params
I have this fuction which is inside a class:

Code: public static function generateEmbedCode($

need help with this contact form
I made this form and I need it to read the data and write the data to a table and its not working ca

Security Exception on pages using AJAX
I am getting the exception: attempted to perform an operation not allowed by the security policy on

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