Thiago,

I used script below to test the regexp to do what you asked.  The expression
follows, then I listed my test code below.

$string =~ m/#(.*)#/;
$information=$1;

Mike Shelton

#! perl -w
#
use strict;

# Get the file with the data
my $file = shift @ARGV;
die "Usage: $0 <FILENAME>\n" if (!$file);

# Read the data into an array
open (IFD, "$file");
my @lines = <IFD>;
close (IFD);

# Do something with it
foreach my $string (@lines) {
        $string =~ m/#(.*)#/;
        my $information=$1;
        print "Information= $information\n";
}

-----Original Message-----
From: Thiago Burin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 3:43 PM
To: [EMAIL PROTECTED]
Subject: Easy expression ...


Hi folks,

I would like to know how I can do the following by using the perl
expressions:

Initial string: "#---- My question is ---- # How to do it # ddfdfff #"
Final string  : " How to do it # ddfdfff #"

In other words, two consecutive "#" defines the information I want to
extract from the document and have for analysis.

I have tried:
$string =~ s/(#.*#)//;
$information=$1;

However, this code extracts everything from the first "#" until the last"#".

What can I do to extract things between the first "#" and the second "#"?

 Thanks!

 Thiago
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to