Is it intentional that the last one's only got three parts to it? Anyhow, here's one regex that'll work:
This will match between 1 and 4 blocks, each consisting of 1 to 3 digits or x's, separated by periods.
Are you dealing with IP addresses there? If so, you may also be interested in Net::IP::Match, Net::IP::Match::* and Net::IP::CMatch.
EDIT: the OP both edited his post and changed the examples of strings he'd like to match after I posted the above. For reference, this was the original post, in its entirety:
I am trying to have a Regex for a dotted number format as shown below
- . . .
So any thoughts how I can make a generic regex for matching all these patterns.