I am currently attempting to use re.search to match either the first pattern or the second pattern. When I do run the script the error I am given is the following: TypeError: unsupported operand type(s) for |: 'str' and 'str'
This is the statement I wrote in the script:
match = re.search("[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"|"[0-9]{1,2}", string)
if match is None:
exit()
I am looking for the search to match with an input that is either something like 255.255.255.0 or an input that is a two digit number such as 24
If possible could someone point me in the right direction to solve this issue? Thanks in advance!