On Mon, 8 Nov 2004, Randy W. Sims wrote:

> [EMAIL PROTECTED] wrote:
> > Hi,
> > I need to capture whole text after "#" character in each line from  a
> > file.The below script is not working can any one suggest the correct
> > thing plz..
>
> Your regexp:
>
> >      if ($line1 =~ /^#\(.*\)/)
                          ^ - This makes to search ( following a # at the
start. I feel you wanted to group and just coded this.

/#(.*)$/
 ^
 Need not be at teh start always
 (.*)$ anything after and is captured in $1 (till line end).

HTH
~A



>
> matches any string that:
>
> begins with '#'
> followed by a literal '('
> followed by zero or more of any character
> followed by a literal ')'
>
>  From your description above, you want something like:
>
>   /#(.*)$/
>
> which captures anything following a '#' up to the end of the string.
>
> Randy.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to