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
  • 73,866
  • 12
  • 100
  • 156
elchueko
  • 439
  • 1
  • 6
  • 20

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
  • 8,021
  • 1
  • 16
  • 27