1
  'Store Domain'                     => '',
  'Store Country'                    => '',
  'Store Phone Reveals Last 7 Days'  => '',
  'Store Phone Reveals Last 30 Days' => '',

Regex noob here, I have the above text, I need to match the spaces inbetween the words. eg 'Store_Domain'.

I have tried (\w+\s?) expression, but it matches the word also,

How do I specify that

  • it starts with ' (quote)
  • then a word and space (this group can be present multiple time) and I need to match only space in this group
  • then it ends with another '(quote)

Edit:

Hmm... The flagged answer didn't help me though. Here is a link to regexr. https://regexr.com/3vqf8

Shobi
  • 10,374
  • 6
  • 46
  • 82
  • 1
    You can use this one to solve your problem.. `$text = preg_replace('~(?:\G(?!\A)|')[^'\s]*\K(?:\s|'(*SKIP)(*F))~', '#', $text); ` – Naveen K Sep 20 '18 at 08:16

0 Answers0