You definately don't want to use ereg.
preg_match has a corresponding function for escaping special characters.
PHP Code:
$delimiter = '/';
$pattern = $delimiter . preg_quote('[url', $delimiter) . $delimiter;
$result = preg_match($pattern, $comment, $matches);
However, if you're just searching for simple strings, its easier to use str_pos:
PHP Code:
$position = strpos($comment, '[url');
Watch out for the difference between a FALSE and a 0 return value from strpos. Use === FALSE or is_int to compare the result of strpos to determine if the string was found.
Bookmarks