title: Why the code not working need to return True or False from the string if regex matches with condition
body: <p>I wrote one program to find the matches. its working fine. If the string is not proper it has to return false. example if my <code>string_</code> contains 2 commas or instead of <code>reject</code> or <code>any</code> if some other string came it has to return <code>false</code>. My string only expect string as <code>reject</code> or <code>any</code></p>
  
  <pre><code>import re
  string_ = '''192.168.1.1,192.168.1.2/32,192.168.1.5-192.168.1.7,reject,any,
  reject,192.168.1.1/32,reject,any,
  172.168.1.4-172.168.1.4,reject'''
  result = re.findall('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/?\d{0,}|[any|reject]+', string_)
  #print(result)
  if result :
      print (True)
  </code></pre>
  
  <p>Expecting false for the string below</p>
  
  <pre><code>     test = '''192.168.1.1,192.168.1.2/32,192.168.1.5-192.168.1.7,reject,any,ip_address
  reject,192.168.1.1/32,reject,any,
  172.168.1.4-172.168.1.4,reject'''
  bool(re.search('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/?\d{0,}|[any|reject]+', test))
  </code></pre>
  
  <p>Expected Out is <code>False</code>, My Out is <code>True</code></p>
  
  <pre><code>test1 = '''192.168.1.1,192.168.1.2/32,192.168.1.5-192.168.1.7,reject,any,,,,
      reject,192.168.1.1/32,reject,any,
      172.168.1.4-172.168.1.4,reject'''
  bool(re.search('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/?\d{0,}|[any|reject]+', test1))
  </code></pre>
  
  <p>Expected Out is <code>False</code>, My Out is <code>True</code></p>
  
  <p>Expected Out</p>
  
  <p><code>False</code></p>
  
  <p>Its not duplicate of <a href="https://stackoverflow.com/questions/6576962/python-regular-expressions-return-true-false">Python regular expressions return true/false</a></p>