On 24 February 2004 12:40, Henry Grech-Cini wrote:

> Hi All,
> 
> function extractFieldsets($subject)
> {
>    $regexp="/<fieldset([^>]*)>[^(<\/fieldset>)]*/i";

This: [^(<\/fieldset>)]
will match any *single* character except the ones listed -- i.e. any character that 
isn't one of: ()<>/defilst

So this: [^(<\/fieldset>)]*
will match any run of characters that is not in that set.

> 
> And it produced;
> 
> (0)=
> (0)=[<fieldset attribute="hello">con]
> (1)=[<fieldset attribute="goodbye">goo]
> 
> Why did it get three letters after the end of the "fieldset" tag????

By coincidence, the 4th letter in each case is one of the set listed above, and so 
ends the match: "t" in "content" and "d" in "goodbye".  If the second example had 
ahppened to be, say, "au revoir", you'd have got 4 characters ("au r").

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to