Thanks to all for your responses
As it turns out I had forgotten a case which all methods are having problems solving.
For example:
my $str = "05/04/2010 13:09:45 - A - somebody - ( ( my.my id >= 1 ) an
+d ( is-mother.to code intersects afunc(val1,val2,val3,val4) and ( is-
+father.to code intersects bfunc(val1,val2,val3,val4) )";
Krambambuli - Nice little one liner
cdarke - I do not have access to feature in this environment and in a very quick look at cpan I could not find what module had feature in it. Sorry, I did not pursue this example.
Marshell - I liked this, good small brute force example
repellent - This is really what I was looking for but like the others it is having problems with ( is-mother.to code intersects afunc(val1,val2,val3,val4).
my $str = "05/04/2010 13:09:45 - A - somebody - ( is-mother.to code in
+tersects afunc(val1,val2,val3,val4) )";
$VAR1 = [
'05/04/2010 13:09:45 - A - somebody - ',
[
'(',
' is-mother.to code intersects afunc',
[
'(',
'val1,val2,val3,val4',
')'
],
' ',
')'
]
];
String is balanced.
Since it seems that all are having issues with this one scenario I am thinking I will have to combine Parse::Balanced with some brute force operations.
One idea I have is to just
- Grab the portions of the line containing this unique pattern(s).
- Remove it from the line and deal with it seperately.
- Finish normally with whats left of the resulting line.
Unless someone can come up with a way to handle the line in it's entirety.
Result should be
my $str = "05/04/2010 13:09:45 - A - somebody - ( ( my.my id >= 1 )
and ( is-mother.to code intersects afunc(val1,val2,val3,val4) and ( i
+s-father.to code intersects bfunc(val1,val2,val3,val4) )";
my.my id >= 1
is-mother.to code intersects afunc(val1,val2,val3,val4)
is-father.to code intersects bfunc(val1,val2,val3,val4)
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.