On Mon, 22 Nov 2004, Anish Kumar K. wrote: > Suppose there is a line > my $line= "[<a href=\"Javascript:performAction(\'Open Window\');\" > class=\"[%um_class1%]\" [%um_master=createUserCourse%]>Create User</a>]"; > > I wanted to get the text "Create User from this line..How will I use regular > expresion to extract it... > > the condition is > > [<a ......%]>TEXT NAME</a>] > > I want only the text name from the pattern..I used $2 and all but no hope...
see if something like this helps. Watch line wrap; There's sure to be a better way #!/usr/bin/perl use strict; my $line= "[<a href=\"Javascript:performAction(\'Open Window\');\" class=\"[%um_class1%]\"[%um_master=createUserCourse%]>Create User</a>]"; if($line =~/^\[.+\]>/){print "goody\n";} print "$'\n"; my $match=$'; $match=~/(.+)<\/a>\]/; print "$1\n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>