Hi,
I have data (seperated by "\n") like this:
MN - Regular expressions are a syntax, implemented in Perl
and certain other environments, making it not only possible but easy to do
some of the following.
ID - 12,13
BA - Character classes are alternative single characters within square
brackets, and are not to be confused with OOP classes, which are blueprints
for objects.If not used carefully, they can yield unexpected results.
I want to match and retrieve the contents of MN and BA.
I tried like this:
if($str=~/MN\s+\-(.*)/)
{
print "\n$1\n";
}
#This prints only part of the string (Regular expressions are a syntax, implemented in Perl)
If i try like this:
if($str=~/MN\s+\-(.*)\nID/)
{
print "\n$1\n";
}
#Its not working!!!
The output should be like this:
Regular expressions are a syntax, implemented in Perl and certain other environments, making it not only possible but easy to do some of the following
Character classes are alternative single characters within square brackets, and are not to be confused with OOP classes, which are blueprints for objects.If not used carefully, they can yield unexpected results
what should i change in order to get that???
Regards
vanitha