I
I
idbubububu2021-05-16 15:36:26
PHP
idbubububu, 2021-05-16 15:36:26

Is it possible to work with a file using the preg_match_all function? if so, how?

I am making a parser. The site code is downloaded to a file to work with regular expressions, but I don't know how to work with the file through the preg_match_all function. I tried to insert the file itself, but it says that you need to insert a string, not a file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-05-16
@idbubububu

<?php
$file_content = file_get_contents($file_path);

preg_match_all($pattern, $file_content);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question