title: Perl Regular expression for IP address range
body: <p>I have some internet traffic data to analyze. I need to analyze only those packets that are within a certain IP range. So, I need to write a <code>if</code> statement. I suppose I need a regular expression for the test condition. My knowledge of regexp is a little weak. Can someone tell me how would I construct a regular expression for that condition. An example range may be like</p>
  
  <pre><code>Group A
  56.286.75.0/19 
  57.256.106.0/21 
  64.131.14.0/22 
  
  Group B
  58.176.44.0/21 
  58.177.92.0/19 
  </code></pre>
  
  <p>The <code>if</code> statement would be like</p>
  
  <pre><code>if("IP in A" || "IP in B") {
          do something
  }
  
  else { do something else }
  </code></pre>
  
  <p>so i would need to make the equivalent regexp for "IP in A" and "IP in B" conditions.</p>