What are some common methods to extract specific information from a string in PHP?

When working with strings in PHP, it is common to need to extract specific information from them. One common method to achieve this is by using regular expressions. Regular expressions allow you to define a pattern to match specific parts of a string and extract the desired information. Another method is to use built-in PHP functions like `strpos`, `substr`, `explode`, or `preg_match` to extract specific information from a string based on certain criteria. Here is an example PHP code snippet that demonstrates how to extract a specific substring from a string using regular expressions:

$string = "Hello, my email is example@email.com";
$pattern = '/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/';
preg_match($pattern, $string, $matches);
$email = $matches[0];
echo $email; // Output: example@email.com