yes, That's actually does. I wasn't finding much to read about this.

David

On Tue, Aug 23, 2011 at 5:12 PM, Stefan Schulte
<stefan.schu...@taunusstein.net> wrote:
> On Tue, Aug 23, 2011 at 04:27:30PM -0400, David Kavanagh wrote:
>> I understand regular expressions. been doing them a long time in
>> various languages. But, how are the fields determined from this regex?
>>
>> David
>>
>
> You have to put everything you want to capture in parentheses, so
>
>  /^Hello (.*)$/.match('Hello World').captures == ['World']
>
> However if you want to just define a block and you don't
> want to capture it you can use (?: and ) instead of ( and ).
>
> I used that in the regex like in
>
>  (?:\s*=\s*(.*?))?
>
> This means there is an optional equal sign with stuff after it as
> indicated by the quotation mark after the block marked with the
> outer parentheses (?: and ). But I dont want to capture the whole
> block so I just capture what is after the equal sign
> (the inner parentheses).
>
> Does this answers your question?
>
> -Stefan
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to