On Thu, May 17, 2007 at 06:40:34PM +0200, [EMAIL PROTECTED] wrote:
> On Thu, 17 May 2007, The Editor wrote:
> 
> >I've noticed if I try and use parseargs on something like
> >
> >test='blue' test-one='green' test_two='red'
> >
> >The first and third will work, but the second fails. The hyphen in the
> >parameter name blocks ParseArgs from seeing it as a parameter name.
> >
> >Is there a reason for it? Could the function be adapted on a custom 
> >basis to allow this?
> 
> I'm pretty sure you can adjust the pattern to allow a hyphen in the name, 
> but Patrick is the guy to ask.

ParseArgs allows an extra parameter that specifies the pattern used
to parse options.  The default is '(?>(\w+)[:=])'.  If you want to
expand this to allow hyphens, it would probably be

    $args = ParseArgs($str, '(?>(\\w[-\\w]*)[:=])');

Pm

_______________________________________________
pmwiki-devel mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Reply via email to