RegEpx hates me!
I tried follows. This text includes spaces and tabs. I don't get a match.
file.txt: other text ABC-1 TYPE-1 I am a newbie and want to learn more about == [ prelregxp 1 ] but I do not know how
DEF 2 TYPE 2 I am a newbie and want to learn more about == [ prelregxp 22] but I do not know how GHI3 TYPE-3 I am a newbie and want to learn more about == [prelregxp 333 } but I do not know how
-> WANTED RESULT
DEF 2 TYPE2;[ prelregxp 22 ]
open(TXT,'<',$filename) or die $^E;
my $text = "";
while(<TXT>) { $text .=$_;}
close TXT;
my $name = "DEF 2";
my $type = "TYPE 2";
$text =s/.*($name $type).*\=\=[\ |\t]{1,}(\[[\s|\t}[0,}[\w]{1,}[\s|\t}[1,}[\d]{1,}[\s|\t}[0,}\])/$1;$2/g;
print $text;
Aucun commentaire:
Enregistrer un commentaire