How to search for a particular string using preg_match

Hi,

I’ve a string “mpeg4” stored in $value as below, which needs to be searched in if statement. But the below if is not searching! What is wrong in this?

if(preg_match(‘mpeg4\d)/i’,$value))
$value = “MPEG-4”;

Please help.

Thanks,
Ramki

As you’re looking for something specific, and not a pattern, maybe you should look at [fphp]stristr[/fphp]. :wink:


<?php

// match exactly
$value = "MPEG-4";

preg_match("/^mpeg\\-\\d{1}$/i",$value, $matches);