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

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

Help with lottery style system?
I'm working on a currency system for forums and it is going to have a type of lottery system built i

Help with some dates
I have a list of dates in an array:

$mondays = array(
strtotime("October 12, 2009

php mysql query from input textbox
Hi,

I have a text box, in that i have given the mysql query. I can able to get the query in v

Staff Induction System - No idea where to go from here!!!
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right directi

php or sql?
Sorry not sure if this is a sql problem or php the following code is supposed to delete data from th

Syntax Help
I'm trying to make a form that edits a php file which contains config settings. I'm using strings t

Save cookie to DB
I'm working on a pixel tracking script for an incentive website and I need to use an ASP script to s

PECL uploadprogress for php5.2
Hey, I just installed PHP5 via .htaccess on my 1and1 Shared Hosting Account.

How would I exac

Sending a hyperlink through mail
HI all,
I am sending a mail to outlook mailbox of a user using FM SO_NEW_DOCUMENT_ATT_S

Problem with creating FI documents
Hi, Experts!

when i create Fi doc. with standart transaction, i ve been had such problem

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