Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Comment mark

by Bilbo (Pilgrim)
on Feb 12, 2003 at 11:28 UTC ( [id://234649]=note: print w/replies, xml ) Need Help??


in reply to Comment mark

This works:

#!/usr/bin/perl -w use strict; my @data = ('# Version: 1.11', '* Version: 1.11', 'Version: 1.11', '/* Version: 1.11'); foreach my $row (@data) { if( $row =~ m/^([\#\*] | \/\* )? \s*version:?\s+ (\d+\.\d+|)/ix) { print "$row \t $2 \n"; } }

and outputs:

# Version: 1.11          1.11 
* Version: 1.11          1.11 
Version: 1.11            1.11 
/* Version: 1.11         1.11 

The regexp looks for lines whixh start either with # or * or with /* or none of these.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-18 01:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found