Мне нужен Php-RegEx, чтобы найти все пробелы между ключевым словом start-keyword и end-keyword и удалить их.PHP RegEx для удаления двух пробелов между двумя словами
$teststring = 'This is a teststring ... :keyword_start: this is the content with double spaces :keyword_end: more text ... :keyword_start: this is the second content with double spaces :keyword_end: ... more text';
мне нужен результат последующих:
This is a teststring ... :keyword_start: this is the content with double spaces :keyword_end: more text ... :keyword_start: this is the second content with double spaces :keyword_end: ... more text
Это то, что я пробовал: (Но это не работает)
$teststring = preg_replace('#(:keyword_start:)\s\s+(:keyword_end:)#si', '', $teststring);
Может кто-нибудь мне помочь?
Попробуйте это [http://stackoverflow.com/questions/2368539/php-replacing-multiple-spaces-with-a-single-space](http:// stackoverflow.com/questions/2368539/php-replacing-multiple-spaces-with-a-single-space) –