I'm trying to match a simplified version of IP addresses (I believe this pattern should match all IP addresses and then some things that aren't IP addresses, but that's not really important.) I'm using this syntax in Python:
'([0-9]{1,3}\.){3}[0-9]{1,3}'
This, however, matches "127.", for example. As far as I can tell it's interpreting what I've provided as a list of patterns rather than a single one. What am I missing?
UPDATE: Yes, sorry everyone, I had a typo. I fixed it.
Everyone is saying the pattern as-is works perfectly, but I'm not getting that. Maybe my issue lies elsewhere:
matches = regex.findall(line)
for match in matches:
matchList.add(label + match)
If I use the pattern '('\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}' instead (same thing, I just repeated, this works perfectly and gives a full IP address. However, if I use the pattern above, it instead gives '195.'
If I put a paren around this expression to get '((\d{1,3}.){3}\d{1,3})', label + match gives me the error 'cannot concatenate string and tuple objects'