D
D
Denis99992016-02-08 13:57:36
PHP
Denis9999, 2016-02-08 13:57:36

PHP preg_match not working when reading text from excel?

It is necessary to extract the link from the text. This text is read from the excel file and is in the $data[$c] variable, more precisely in the $data[$c] string;.
The code is like this:

preg_match('/http(.*)/i', $data[$c], $link);   //регулярное выражение максимально упростил
echo '$link:';
print_r($link);

But it doesn't work, then I just put some text in the test string and applied preg_match to it and it worked. After that, I decided maybe something was wrong with the types and started converting $data[$c] to a string type:
$str = strval($data[$c]);
But that didn’t help either, now I’m writing to the forum.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2016-02-08
@VladimirAndreev

and in general the normal text is in $data[$c]?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question