I'm trying to write a regular expression to divide up a line of text
into a hash, but am having a hard time with it.  I'm hoping you all can
help me.

Here's an example line of text:

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

Each line is similar, yet different.  :)  Basically, I want to divide
each line up into a hash, with the keys being the words in all caps, and
the values being the text after the key (up until the next key or
end-of-line).  So, the above example would become (logically):

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

Not every line will have the same keys, or the same number of keys.  Is
there a good way to do this with a regular expression?

Thanks.

Jason

--
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