No complete solution but something for you to start with.. if you want to do that all by yourself you should learn how to deal with string functions in php so here are some examples with functions you might use:
with strpos() you can get the position of a substring in a string.
so
$string = 'Our <meta> test.';
$substring = '<meta>';
$position = 0;
$position = strpos($string, $substring);
This will set $position to 4.
with strstr() you get the rest of a string after a substring.
$string = 'Our <meta> test.';
$substring = '<meta>';
$newstring = strstr($string, $substring);
This will set $newstring to "<meta> test.";
with substr() you get a substring of a string from an defined start position and with a defined length.
$string = 'Our <meta> test.';
$substring = '<meta>';
$newstring = substr($string, 4, 6);
This will set $newstring to "<meta>";
For these and other string functions have a look at
PHP Manual - String Functions
Then play around with these functions and if you have developed a basic approach feel free to ask again.
Cheers