Home: Perl Programming Help: Beginner:
Post deleted by Gally



Gally
New User

Aug 15, 2002, 9:23 AM


Views: 4858
Post deleted by Gally

 


fashimpaur
User / Moderator

Aug 15, 2002, 10:34 AM


Views: 4856
Re: [Gally] Help with regular expressions (regexes)

Gally,

If you want a real good Template module, try using HTML::Template.
You can use it even if the rest of the file is plain text.

As for the regex you need,

try this:


Code
   


@tags
= ();

while (<DATA>){
$line = $_;
chomp $line;
while ($line =~ /<\?([^>]+)(?=\?>)/g){
push @tags, $1;
$line = $';
}
}

print
join("\n", @tags);

__DATA__

Here is a sample <?Filetype?> file. It is used to <?usage?> data in another
file. Please feel free to use <?programname?> often.

Thank you,

<?
salesrepname?>
<?
salesreptitle?>

Hope this does what you expected.

Good Luck,
Dennis

$a="c323745335d3221214b364d545".
"a362532582521254c3640504c3729".
"2f493759214b3635554c3040606a0",
print unpack"u*",pack "h*",$a,"\n\n";