is there a way to tell the occurence postition of the regex given ??

for example ..
$text = 'PHP Hypertext Preprocessor';

if (preg_match('xt', $text)){
echo 'Found Match';

Like in that example occurence position is 11.. I already know about the strpos() .. but that doesnt accept regex .. .

What im trying to do is take user input form a form and filter it ... convert everything to htmlspecialchars ... but only allow <object > </object> tags , and everything in between to stay intact .. &quot; <object width=""></object>&quot; tags...

Any help would be appreciated.

$subject = "PHP Hypertext Preprocessor";
$pattern = '/xt/';
preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE);
print "<pre>";
print "</pre>";

$matches[1] returns 11.
It works but I didn't understand the concept of flags !

Cool . Thanx .. I actuially realized i didnt even need the occurence postion to do that ..
this is what i did from the i dea you gave me ..


	  $subject = '<a href="">Full Court Shot</a><br/><object width="430px" height="386px"><param name="wmode" value="transparent"/><param name="allowscriptaccess" value="always"/><param name="movie" value=""/><param name="flashvars" value="culture=en-US&a=0&ap=0&y=0&m=35913278&userid=-1&showmenus=0&remove=0&t=&type=video"/><embed src="" width="430" height="386" flashvars="culture=en-US&a=0&ap=0&y=0&m=35913278&userid=-1&showmenus=0&remove=0&t=&type=video" type="application/x-shockwave-flash" allowscriptaccess="always" /></object>';

      $pattern = '/\<object.{1,700}\<\/object\>/';

      preg_match($pattern, $subject, $matches);
      $new_data = preg_split($pattern, $subject);
//      print_r($new_data);
      $article = htmlspecialchars($new_data[0]) . "<br>\n" . $matches[0][0] . "<br>\n" . htmlspecialchars($new_data[1]);
      echo $article;

its the closest thing to perfect that i was able to think of .. Thnax