Guys, tell me how to parse the file to get a string Example text:
Text Text Text Text Email: mail.mail@mail.ru Text Text Text Text
you need to get the email in this file, that is, to receive the data after the word "Email:"
Guys, tell me how to parse the file to get a string Example text:
Text Text Text Text Email: mail.mail@mail.ru Text Text Text Text
you need to get the email in this file, that is, to receive the data after the word "Email:"
To do this, you can use regular expressions. For example, you can build on the following script:
<?php //$str = 'Текст Текст Текст Текст Email: mail.mail@mail.ru Текст Текст Текст Текст '; $str = file_get_contents('text.txt'); $pattern = '/Email:\s+([^\s]+)\s/'; preg_match_all($pattern, $str, $out); echo '<pre>'; print_r($out[1]); /Email:\s+(\S+)/ - splash58Source: https://ru.stackoverflow.com/questions/545493/
All Articles