On Thu, Sep 18, 2003 at 12:03:08PM -0400, [EMAIL PROTECTED] wrote:
> 
> I just discovered Regexp::Common today, and it's most excellent.  But I'm having 
> trouble using $RE{ comment }{ Java }.  Apparently doing something like:
> 
>    grep /$RE{ comment }{ Java }/, <MY_JAVA_FILE>;
> 
> only catches comments of the form:
> 
>    // . . .
> 
> and misses comments of the form:
> 
>    /* . . .
>       . . .
>    */
> 
> Is this a bug?  Did I forget a prerequisite config thingy?  Can someone please point 
> out my luser error?

My guess is that grep() in that circumstance is reading line by line,
and you'd want to either slurp the file into a single scalar, or force
grep() to be greedy [this works with m// using the s modifier, but may
not with grep?].

I'm really not sure, tho.

Do you get any different results with:
my $entiretext = <MY_JAVA_FILE>;
grep /$RE{ comment }{ Java }/, $entiretext;

?

/joel

Reply via email to