Though maybe this is what you want since you explicitly capture the matching substring.
Janos Holanyi: I would really need to build up a re that would match one line and only one line - that is, excluding carriage-return-newline's (\r\n) from matching... This allows plain carriage return or plain newline.
Thanks to bbh and Donal Fellows for this regular expression.
Since it's not anchored to the start and end of the string (with ^ and $) it will match any string that contains four groups of 1-3 digits separated by periods, such as: "184.108.40.206.9".
If you don't mind a longer regexp, there is no reason you can't ensure that each group of 1-3 digits is in the range of 0-255.
Regular Expression Examples is a list, roughly sorted by complexity, of regular expression examples.