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

modifying query string with no page refresh
Hi everybody,
I've tried to get info about my problem all over the internet but i didn't find out

How to form a xml form table with a single sql statement..?
Hi everyone,
I don't know if this is going to be a duplicate thread but i couldn't

Mail Form receiving emails with no content
Hi, I hope someone here can help me.
I have a simple form in my website, it was working OK, after

void* and sizeof()
Hi,

Using void* and sizeof is it possible to get the value of the object ?

I understan

server trace logs
could any one tell me from where do i get error logs in xMII??I want to check the reason for dtabase

Working with Global Variables
hi, I'm not really sure why the following code is returning a "Call to a member function getBan

How to Handle more than one submit button in single form?
Hi
I have one PHP file which contains one Form. In this form there are two Submit type Buttons

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

PHP5/Zend 2.0 - Resources
PHP5 Snapshots
http://snaps.php.net/

ZEND 2.0 Feature Overview and Design (PDF File

Login Functionality Working Different on IE
This is an odd one, I have a site which has an admin section. The admin pages unsurprisingly require

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