- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$message = "
[xxxStudent.address_1xxx][xxxStudent.address_2xxx][xxxStudent.address_3xxx]
[xxxStudent.townxxx]
[xxxStudent.countyxxx]
[xxxStudent.postcodexxx]
[xxxStudent.country_iso_2xxx]";
preg_match_all('/\[xxx(\w+[\.+\w+]+)xxx\]/', $message, $tags, PREG_SET_ORDER);
var_dump($tags);