CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
blank lines regular expression

 



devi
Novice

May 10, 2012, 11:49 AM

Post #1 of 3 (11173 views)
blank lines regular expression Can't Post

i have below lines of code in my tool (cloc--> code count tool) with which it recognizes blank lines

filter remove_matches ^\s*//

but, i want to tell the tool that if a any line contains less than 2 characters then it should consider that line as Blank line. How can modify the above regular expression to consider a line as blank line if it contains less than 2 characters.


FishMonger
Veteran / Moderator

May 10, 2012, 12:01 PM

Post #2 of 3 (11171 views)
Re: [devi] blank lines regular expression [In reply to] Can't Post

/^.{0,1}$/


(This post was edited by FishMonger on May 10, 2012, 12:01 PM)


rovf
Veteran

Jun 15, 2012, 3:38 AM

Post #3 of 3 (6122 views)
Re: [devi] blank lines regular expression [In reply to] Can't Post


Code
chomp($line); 
if(length($line)<2) { ignore_this_line() }


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives