Question: I'm trying to define a regex in php to extract words but i didn't succeed... 
My string is always in this format: "toto=on test=on azerty=on gogo=on" 
what I would like to do is to get in an array the values toto, test,azerty and gogo. Can someone help ? 

that's what i tried so far : `/([^\s]|[w]*?=)/`

Answer: 
It's simple

```
preg_match_all("/(\w*)=/", "toto=on test=on azerty=on gogo=on", $output_array)[1];

```

It will get all word before "=", the parentheses is for defining a group and put in key "1" , "\w" is for a letter and "\*" is for "many"

or You can improve that and use like that

```
preg_match_all("/(\w*)=on/", "toto=on test=on azerty=on gogo=on", $output_array)[1];

```

So will get only parameters "on", if you have "toto=on test=on azerty=on gogo=on toff=off", the string "toff" dont will appear

I like to use this link <http://www.phpliveregex.com/> , so you can try regex and responses in PHP
A different approach to this question would be this way

```
<?php

$str = "toto=on test=on azerty=on gogo=on";
$res = str_replace("=on","", $str);
$array = explode(" ", $res);
print_r($array); //Array ( [0] => toto [1] => test [2] => azerty [3] => gogo )

?>

```