<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Using regular expression in perl' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Using regular expression in perl' posted on the 'Perl' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 22:29:34 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 22:29:34 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Using regular expression in perl</title>
      <link>http://www.programmersheaven.com/mb/perl/423180/423180/using-regular-expression-in-perl/</link>
      <description>Hello Guys,&lt;br /&gt;
&lt;br /&gt;
Sorry, I am not sure if this thread belongs here.&lt;br /&gt;
I am new to perl and writing a regex for identifying if the user input lies in the set [0,100), i.e. the number must lie between 0-100, 0 included. It can be of form 0.000001, .00001, 90, 90.999153263, .12 etc&lt;br /&gt;
Following is the regex I wrote: $input =~ /\d\d?\.\d+|(\d\d?|\.\d+)/, but I am not gettinh the result. Can someone help me in this? Thanks in advance.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/423180/423180/using-regular-expression-in-perl/</guid>
      <pubDate>Wed, 13 Apr 2011 00:57:01 -0700</pubDate>
      <category>Perl</category>
    </item>
    <item>
      <title>Re: Using regular expression in perl</title>
      <link>http://www.programmersheaven.com/mb/perl/423180/425573/re-using-regular-expression-in-perl/#425573</link>
      <description>A powerful way of doing this is&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;my $number = 0.4e2;

if ($number =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) {
#   my $number = eval $&amp;amp;;     # I don't know if you really need this
    if ($number &amp;gt;= 0 and $number &amp;lt;= 100) {
        print "$number is &amp;gt;= 0 but &amp;lt;= 100\n";
    }
    else {
        print "$number is NOT between 0 and 100\n";
    }
}
else {
    print "Invalid number input: $number\n";
}&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
or a simpler way:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;my $number = 52.9923;
if ($number &amp;gt;= 0 and $number &amp;lt;= 100) {
    print "$number is &amp;gt;= 0 but &amp;lt;= 100\n";
}
else {
    print "$number is not between 0 and 100\n";
}&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
You can remove '=' sign from 'greater/lower' signs if don't want to include 0 and 100.&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/423180/425573/re-using-regular-expression-in-perl/#425573</guid>
      <pubDate>Fri, 04 Nov 2011 03:09:04 -0700</pubDate>
      <category>Perl</category>
    </item>
  </channel>
</rss>