On 7/15/10 Thu Jul 15, 2010 12:24 PM, "Chandan Kumar" <chandan_28...@yahoo.com> scribbled:
> Hi guys, > > I could able to understand the quantifiers. But still stuck with one > confusion.if dot operator is used with quantifiers. > > ex: my string is $_="thiiiis is my first regular expression"; > > please explain the below questions with answer. > 1)thi.*? > 2)thi.+? > 3)thi.+?s > 4)thi.*?s I suggest you use these constructs in a program, print out the results, and see if you can deduce why they give the results they do. Here is some help: % perl -e '$x=q(thiiiis is);$x=~m{thi(.*?)};print qq("$1"\n);' "" % perl -e '$x=q(thiiiis is);$x=~m{thi(.+?)};print qq("$1"\n);' "i" % perl -e '$x=q(thiiiis is);$x=~m{thi(.*?)s};print qq("$1"\n);' "iii" % perl -e '$x=q(thiiiis is);$x=~m{thi(.+?)s};print qq("$1"\n);' "iii" -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/