|
Posted by Scott on 03/21/06 22:46
On Tue, 2006-03-21 at 20:39 +0000, splodge wrote:
> I have a simple regular expression:
>
> [0-9]{1,5}x[0-9]{1,5}
>
> Which is designed to detect the width and height of an image from a
> string, as in:
>
> foo 100x100 bar
>
> However, when I run this with preg_match I get an unknown modifier
> error, pointing to { . Could someone please explain what I am doing
> wrong and how to make this work.
>
> preg_match("[0-9]{1,5}x[0-9]{1,5}", $output, $widthHeight);
>
> $output is the string containing the width height values
> $widthHeight is the returning array.
> Many thanks.
>
> P.s. Maximum image size is 99999x99999
Try enclosing your expression with / /.
preg_match("/[0-9]{1,5}x[0-9]{1,5}/", $output, $widthHeight);
Navigation:
[Reply to this message]
|