On Jun 24, Price, Jason (TLR Corp) said:

>"( uiwgAttribute-OID NAME 'uiwgAttribute' DESC 'Contains meta data about
>an attribute' SUP top MUST cn MAY ( uiwgADsType $ uiwgDescription $
>uiwgDisplayName $ uiwgIsMultiValued ) )"

>       NAME -> 'uiwgAttribute',
>       DESC -> 'Contains meta data about an attribute',
>       SUP -> 'top',
>       MUST -> 'cn',
>       MAY -: '( uiwgADsType $ uiwgDescription $ uiwgDisplayName $
>uiwgIsMultiValued )'
>}

This isn't too bad for a regex.  I don't know what specifically your
quoting rules are, but here's a shot:

  # this "fast-forwards" us past the "( uiwgAttribute-OID" part
  $string =~ /\(\s*\S+/g;

  # this gets the remaining pairs
  my %data = $string =~ /\G\s*(\w+)\s+('[^']*'|\([^)]*\)|\S+)/g;

You'll retain the quotes and parentheses found in your data; removing them
just requires another pass over the hash.

My regex doesn't handle nested parentheses, by the way.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to