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 please - How to validate from 2 possible answers
Hi

I hope somebody can help me with what will probably be really simple, I'm pulling my hair

SAP Logon Failed
I tried to login to SAP through MMC.

When i click start and give password.

it

Baffled by Undefined Index in Simple Array: Please Help!
Hello. I have a form which posts an array to this script. However, I can't seem to access the values

Members Only
Hi all, for my website i have a members area only which on members can veiw, but at the moment anyon

puting for loop in 1 value
hi ,

how do i put this code in 1 value:
Code: <?php
for ($i=1; $i<=5; $i

Port scanner problem
Hai
recently i developed one app through which u can check the opened and closed ports under an

List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab

retrieving images from mysql database using php
So I've been trying to figure out how to store images in a mysql database, and as far as i can tell

why does my session end?
my connect.php starts the session just so you know
i can navigate arround my site fine except whe

Form help: Syntax & Logic
Hello again all,

I'm working on a form and ran into a wall (again) and can't seem to think th

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