2

I am new to PHP regular expression syntax. Using the following two lines, I was able to phrase a website depending on the following characters : newline

$html = @file_get_contents("http://news.yahoo.com");
$webwords = preg_split("/[:'\n\"]+/", $html);

Above code will only allow me to phrase a website depending on individual characters. Can you please tell me how I can parse a website with word phrases ? For example, above individual characters alone with the word image_17

$webwords = preg_split("/[:'\n\"]+ | (image_17) /", $html);     ??
Lajos Veres
  • 13,595
  • 7
  • 43
  • 56
D P.
  • 1,039
  • 7
  • 27
  • 56

1 Answers1

2

Maybe do you need something similar?

$html = 'xxx:yyyimage_17aaa:9999';
$webwords = preg_split("/([:'\n\"]+|image_17)/", $html);
print_r($webwords);

And the output:

Array
(
    [0] => xxx
    [1] => yyy
    [2] => aaa
    [3] => 9999
)
Lajos Veres
  • 13,595
  • 7
  • 43
  • 56