What are some common mistakes to avoid when working with regex in PHP?

One common mistake when working with regex in PHP is not properly escaping special characters. To avoid this issue, use the preg_quote() function to escape any special characters in the regex pattern.

$pattern = '/^Hello, world\.$/';
$escaped_pattern = preg_quote($pattern, '/');
```

Another mistake is not using the correct delimiters in the regex pattern. Make sure to use the appropriate delimiters at the beginning and end of the pattern, such as '/' for most cases.

```php
$pattern = 'Hello, world.';
$correct_pattern = '/' . $pattern . '/';
```

Lastly, forgetting to use the preg_match() function to actually perform the regex match can lead to errors. Always remember to use preg_match() to apply the regex pattern to a string.

```php
$string = 'Hello, world.';
$pattern = '/^Hello, world\.$/';
if (preg_match($pattern, $string)) {
    echo 'Match found!';
}