Re: Newbie help with regular expression

Kwok Peng Tuck <[email protected]> Wed, 07 Aug 2002 09:14:30 +0800
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <[email protected]>
Thanks. I'll work on your suggestions.

[email protected] wrote:

>Hi I think I would use something like
>perl5.split(list, "(group ?= ?.*)", yourString);
>By parenthesizing the regexp, the found result also appears in the list,
>then you can just iterate over this list. And use the odd elements as key
>for a hash for instance and the even elements in the list as the
>corresponding value.But having a configuration file like this, it might be faster and easier
>to read it line by line, parse the lines sequentially and route the output
>to wherever you want it to go.Further more, It's quite normal these days to use xml for configuration
>files.jeroen.
>  
>
>>Hi, I'm new to regular expression and would like some help/thoughts
>>with  the following questions.
>>I have a configuration file which looks a bit like this:
>>
>>group = core
>>..............
>>.............
>>.............
>>...............
>>
>>group = smsbox
>>............................
>>............................
>>...........................
>>...........................
>>
>>My first question is :
>>How do I correctly write a regular expression that will let me say give
>>
>>me the contents of the group = core ?
>>I tried this \s*group\s*=\s*core\s*([^>]*)\s*group\s*=\s*smsbox\s* but
>>that isn't really working as it would depend on group = smsbox being
>>there. Is there
>>a way around this ?
>>
>>My second question is this:
>> How can I extract  multiple identical groups  ( for example there are
>>many 'group = smsbox' ) ? I would like to extract all the groups that
>>match.
>>
>>My apologies if  my questions aren't clear to anyone, I will clarify if
>> I need to. Thank you.
>>
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:[email protected]> For additional
>>commands, e-mail: <mailto:[email protected]>
>>    
>>
>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[email protected]>
>For additional commands, e-mail: <mailto:[email protected]>
>
>
>  
>