Ok, a good strategy might be to break it up by the ( and ) characters first, then further process the parts:<br><br>@part = split(/[()]/, $condstring);<br><br>This gives you a "shallow parse", which may or may not be a useful starting point.<br>
<br>- Dave<br><br><div class="gmail_quote">On Fri, Feb 19, 2010 at 10:45 AM, Jay Swackhamer <span dir="ltr"><<a href="mailto:Jay@reboottheuser.com" target="_blank">Jay@reboottheuser.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">In the string below, it's from a parameter file.<br>
<br>
I need to break it out by what's the longest string between the '(' and the ')'<br>
and then the shorter strings between '(' and ')' , then the and/or's so I can translate/process the logic.<br>
<br>
the include_1 would be a condition name, and the f7/f10/f8 etc are field names that are substrings of lines of data.<div><br>
<br>
-- <br>
Jay Swackhamer<br>
Reboot The User<br>
402-933-6449<br>
<a href="http://www.reboottheuser.com" target="_blank">http://www.reboottheuser.com</a><br>
<a href="http://www.cafepress.com/rtu" target="_blank">http://www.cafepress.com/rtu</a><br>
<a href="http://stores.ebay.com/RebootTheUser" target="_blank">http://stores.ebay.com/RebootTheUser</a><br>
<a href="http://www.hotr.com" target="_blank">http://www.hotr.com</a><br>
<br>
<br></div><div><div></div><div>
Quoting Dave Burchell <<a href="mailto:evaddnomaid@gmail.com" target="_blank">evaddnomaid@gmail.com</a>>:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sure Jay, I'm no guru but I use regex whenever I can.<br>
<br>
What do you mean when you say "based on what is between '( )'"?<br>
<br>
- Dave<br>
<br>
On Fri, Feb 19, 2010 at 10:17 AM, Jay Swackhamer  <<a href="mailto:Jay@reboottheuser.com" target="_blank">Jay@reboottheuser.com</a>>wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Looking at examples, not getting it done.<br>
<br>
Any regex gurus out there that can give me a tip on taking a string and<br>
splitting into groups based on what is between '( )'<br>
<br>
So I can take condstring, split it into an array by whats grouped in (),<br>
then take each element and split out the rest of the () groups.<br>
i.e.<br>
<br>
 my $condstring="include_1 (f7 ne \'ce\' and f10 ne \'r\' and f1 ne \'ce\'<br>
and f8 ne \'lg\' and f8 ne \'li\' and f8 ne \'lj\' and f8 ne \'lr\' and f8<br>
ne \'lu\' and f8 ne \'lv\' and f8 ne \'tl\' and f8 ne \'ta\' and(f4 eq \'e\'<br>
or f4 eq \'g\' or f4 eq \'w\')) ";<br>
<br>
 @condarr = split /(\).*\))/, $condstring;<br>
<br>
<br>
--<br>
Jay Swackhamer<br>
Reboot The User<br>
402-933-6449<br>
<a href="http://www.reboottheuser.com" target="_blank">http://www.reboottheuser.com</a><br>
<a href="http://www.cafepress.com/rtu" target="_blank">http://www.cafepress.com/rtu</a><br>
<a href="http://stores.ebay.com/RebootTheUser" target="_blank">http://stores.ebay.com/RebootTheUser</a><br>
<a href="http://www.hotr.com" target="_blank">http://www.hotr.com</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Omaha-pm mailing list<br>
<a href="mailto:Omaha-pm@pm.org" target="_blank">Omaha-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/omaha-pm" target="_blank">http://mail.pm.org/mailman/listinfo/omaha-pm</a><br>
<br>
</blockquote>
<br>
<br>
<br>
--<br>
Dave Burchell<br>
<br>
</blockquote>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Dave Burchell<br>