Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Text Extraction Problems

by Roger (Parson)
on Oct 07, 2004 at 13:38 UTC ( [id://397297]=note: print w/replies, xml ) Need Help??


in reply to Text Extraction Problems

Why making it so complicated? You could use a much simpler regular expression and then remove the quotes later.

#!/usr/bin/perl -w use strict; while (<DATA>) { chomp; print "$_\n"; if (/-(\S+)(\s*(.*))?/x) { my ($p1, $p2) = ($1, $3); if (defined $p2) { $p2 =~ s/^"//; $p2 =~ s/"$//; } print "[$p1][$p2]\n"; } } __DATA__ -libs "source*.lib source*.lib" -1dlu -2dlu -3dlu "(1,1,3)" -filter ASDF

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://397297]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found