#!/usr/bin/env python3
#https://pythex.org/

import re

whitelist = '''
===== Whitelisting request on 2018-05-28 ======

==== ADD =====

=== PROD ===

== SPINT ===
221.247.129.131/32 devnet agm scei devnet-siedev.net
113.108.226.40/32 devnet netease-gz scek devnet-siedev.net
109.90.60.255/32 devnet warned scee devnet-siedev.net
109.90.60.192/27 devnet warned scee devnet-siedev.net
109.90.60.0/25 devnet warned scee devnet-siedev.net
109.90.60.128/26 devnet warned scee devnet-siedev.net
150.101.108.117/32 devnet giant_margarita scee devnet-siedev.net
109.90.60.224/28 devnet warned scee devnet-siedev.net
183.177.134.178/32 devnet agm scei devnet-siedev.net
109.90.60.254/32 devnet warned scee devnet-siedev.net
210.188.185.0/24 devnet abianzza scei devnet-siedev.net
109.90.60.240/29 devnet warned scee devnet-siedev.net
113.108.226.41/32 devnet netease-gz scek devnet-siedev.net
118.243.39.88/32 devnet agm scei devnet-siedev.net
109.90.60.248/30 devnet warned scee devnet-siedev.net
109.90.60.252/31 devnet warned scee devnet-siedev.net
202.32.96.85/32 SCEJ-Licensee Shuichiro Ohara Internet Revolution, Inc. SCEJ Akita Takayuki(at.80881@i-revo.co.jp)

== PRODQA,SPINT ===
52.35.254.21 Source SCEJ-Licensee Shuichiro Ohara CAPCOM CO., LTD. SIEJ Madoka Ohashi(madoka-ohashi@capcom.com)
52.35.254.21/32 Source SCEJ-Licensee Shuichiro Ohara CAPCOM CO., LTD. SIEJ Madoka Ohashi(madoka-ohashi@capcom.com)

=== NONPROD ===

===============================================================
Regards,
SNEI-NOC

'''
ipaddressRegex=re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}')

mo=ipaddressRegex.findall(whitelist)
print(mo)
print(type(mo))


ipaddressRegexeither=re.compile(r'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})?)')
nosubnet=re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s')
nosubmatch=nosubnet.findall(whitelist)
print(nosubmatch)

mo1=ipaddressRegexeither.findall(whitelist)
print(mo1)
print(len(mo1))
#print(type(mo1))
#print(mo1[0])
#print(type(mo1[0]))

#ipaddress,net=mo1[0]
#print(ipaddress)

addresslist=[]
for i in range(len(mo1)):
 #   print(i)
    ipaddress,net=mo1[i]
    addresslist.append(ipaddress)
    print(ipaddress)
print(addresslist)

for i in addresslist:
    if i == nosubmatch:
        print(True)



lylics = '''
On the twelfth day of Christmas, my true love gave to me
12 drummers drumming,
11 pipers piping,
10 lords a-leaping,
9 ladies dancing,
8 maids a-milking,
7 swans a-swimming,
6 geese a-laying,
5 golden rings.
4 calling birds,
3 French hens,
2 turtle doves,
and 1 partridge in a pear tree.
'''

xmasRegex = re.compile(r'(\d+\s\w+\s(\w*-)?\w*)')
print('')
mo4=xmasRegex.findall(lylics)
print(mo4)
print('')

for i in range(len(mo4)):
    lylics,extra=mo4[i]
    print (lylics)

#[] --same as (| |)

vowelRegex = re.compile(r'[aeiouAEIOU]') # essentially same as r'(a|e|i|o|u)

a=vowelRegex.findall('Robocop eats baby food')
print(a)


doublevowelRegex = re.compile(r'[aeiouAEIOU]{2}') # {2} will find 2 continuous vow
b=doublevowelRegex.findall('Robocop eats baby food')
print(b)

# if we add '^", and then anything other than blacket will be found.

negvowelRegex = re.compile(r'[^aeiouAEIOU]') # essentially same as r'(a|e|i|o|u)

c=negvowelRegex.findall('Robocop eats baby food')
print(c)