0

I have the following text:

"text tutorial" tutorial tipps tricks diy fashion "fashion style"

No I want to have a regular expression which splits the text above to single keywords. All the keywords which a in quotes should be fined as a single keyword.

The output of the regular expression should be this:

  1. text tutorial
  2. tutorial
  3. tipps
  4. tricks
  5. diy
  6. fashion
  7. fashion style

Thanks.

Alan Moore
  • 71,299
  • 12
  • 93
  • 154
elchueko
  • 411
  • 1
  • 6
  • 19

1 Answers1

0

use a str_getcsv(), Try:

str_getcsv($text, ' ')

Output of str_getcsv();

Array
(
    [0] => text tutorial
    [1] => tutorial
    [2] => tipps
    [3] => tricks
    [4] => diy
    [5] => fashion
    [6] => fashion style
)
Dhara Parmar
  • 7,791
  • 1
  • 14
  • 25