Re: can not filter out commentary lines with reg-exps
- From: bjorge.solli@xxxxxxxx (Bjorge Solli)
- Date: Wed, 29 Mar 2006 14:45:39 +0200
On Wednesday 29 March 2006 14:22, Harald wrote:
I need to parse an ASCII file which first rows are comments. Those rows
are marked by a '#' at their beginning.
I try to filter them out by
while( <$FH> =~ m{\#*} )
while( <$FH> =~ m{^\#.*} )
{}
But this does not work. The loop does never stop.
What goes wrong? I am really confused!
Your * refers to the #, saying you want to match all # occuring at least 0
times. My * refers to the . and so my regex says match a # at the beginning
of the line and the rest of that line (since * is greedy).
--
Bjørge Solli - Office:+47 55205847 cellph.:+47 91614343
Nansen Environmental and Remote Sensing Center - Bergen, Norway
http://www.nersc.no Reception: +47 55205800
Dept.: Mohn-Sverdrup Center for Global Ocean Studies
and Operational Oceanography
.
- References:
- can not filter out commentary lines with reg-exps
- From: Harald
- can not filter out commentary lines with reg-exps
- Prev by Date: How to split a string read from the file?
- Next by Date: Whimsical Question
- Previous by thread: can not filter out commentary lines with reg-exps
- Next by thread: Re: can not filter out commentary lines with reg-exps
- Index(es):
Relevant Pages
|