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:
Stuck on this Rexexp... please help???

 



chetwyn
Novice

Apr 26, 2006, 6:02 AM

Post #1 of 2 (2409 views)
     Stuck on this Rexexp... please help???  

Hi all. I want to only retrieve the lines of text that have no spaces breaking the text. for example, here is some exmaple text:

**** START ****


Sydney City Plumbing
Unit 3/5- 7 Stanley St Peakhurst NSW 2210


Dempsey Plumbing & Electrical
408- 410 Canterbury Rd Campsie NSW 2194


Paul Bevins
94A Cardinal Ave West Pennant Hills NSW 2125


Conomos Plumbing

RPM Pipeline Maintenance
Werrington Downs NSW 2747



**** END ****

So I only want things like:

RPM Pipeline Maintenance
Werrington Downs NSW 2747

Not like

Conomos Plumbing



This is what I have so far but it's not working...

open (IN,"teststr.txt")||die"can not open file\n";
close(IN);
while(<IN>){
$_ =~ /^\w+.*\w+$/s;
print $_."\n";
}


davorg
Thaumaturge / Moderator

May 2, 2006, 1:14 AM

Post #2 of 2 (2393 views)
     Re: [chetwyn] Stuck on this Rexexp... please help??? [In reply to]  

Please don't post the same question in two or more areas of the site. Most of us read every section.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


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

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