Hi Experts,
I am studying about regular expression and struck with the
lookaround concept
and
with few syntax.
After doing googling, I thought it is a right forum to ask for help. Please help with this concept.
As I am not good with understanding the explanation. It will be great if I get plenty of different examples to understand.
For me the modifer /e
and ||
are new in regex please help me in understanding
the real use. Below is my Perl Script.
$INPUT1="WHAT TO SAY";
$INPUT2="SAY HI";
$INPUT3="NOW SAY![BYE]";
$INPUT4="SAYO NARA![BYE]";
$INPUT1=~s/SAY/"XYZ"/e; # /e What is this modifier is for
$INPUT2=~s/HI/"XYZ"/;
$INPUT3=~s/(?<=\[)(\w+)(?=])/ "123"|| $1 /e; #What is '||' is use for and what its name
$INPUT4=~s/BYE/"123"/e;
print "\n\nINPUT1 = $INPUT1 \n \n ";
print "\n\nINPUT2 = $INPUT2 \n \n ";
print "\n\nINPUT3 = $INPUT3 \n \n ";
print "\n\nINPUT4 = $INPUT4 \n \n ";