PHP正则表达式与IPv4

I have problems figuring out a regular expression on this pattern

oSevenDigits-TwoDigits-aValidIPv4Adress

I tried

$_regex = "/(o[0-9]{7})-[0-9]{2}-^((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}\z/";

but it seems to be wrong in multiple ways...

Try this one

$_regex = '/^\d{7}\-\d{2}\-((2([0-5]{2}\.)|1[0-9]{2}\.)|([1-9]{1,2})\.){3}((2[0-5]{2})|(1[0-9]){2}|[0-9])$/';

You cannot have line start ^ in the middle of regex here:

$_regex = "/(o[0-9]{7})-[0-9]{2}-^((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}\z/";

Change this to:

$_regex = "/(o[0-9]{7})-[0-9]{2}-((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}/";