0

String is stored in $variable. $variable looks like:

 plusCardName: 'Plus Card', over the hills 'fire' city 'song'. 

Need to output what is inside ''. Output would be:

 Plus Card
 fire
 song
9
  • more detail here stackoverflow.com/questions/30549300/… Commented May 30, 2015 at 18:51
  • You literally asked this question now 3 times really?! 1. here 2. stackoverflow.com/q/30549300/3933332 3. stackoverflow.com/q/30552175/3933332 I already explained you that you should not do that! stackoverflow.com/questions/30552175/… I will answer your question this time, but don't do such things again. Next time I will close them all with the first question and I won't answer them. Commented May 31, 2015 at 0:56
  • I have a lot of patience and maybe even more than others do. But if you don't take the time to read my comments and still reposting the same question 4 times + then getting rude with: (quoted:) cry me a river bitch – Adreamcathcer Adreamcatcher 22 secs ago (quote end) We are slowly getting to an end of my patience. Commented May 31, 2015 at 1:05
  • you deleted your answer, how is that helpful to anyone? Commented May 31, 2015 at 1:10
  • if you would have just answered the question instead of all the dramatics we would all be winning. Commented May 31, 2015 at 1:11

2 Answers 2

2

Check this:

function get_delimited($str, $delimiter='"') {
    $escapedDelimiter = preg_quote($delimiter, '/');
    if (preg_match_all('/' . $escapedDelimiter . '(.*?)' . $escapedDelimiter . '/s', $str, $matches)) {
        return $matches[1];
    }
}

$words = get_delimited("'Plus Card', over the hills 'fire' city 'song'","'");
Sign up to request clarification or add additional context in comments.

2 Comments

I need to do it to a $variable that contains text like ...'/static/gf816a20'; window.localEnvironment = {}; requireQ(["everything"], function() { angular.module('environment'....
0
<?php

preg_match_all("/'([^']*)'/", $str, $m);
print_r($m);

?>

love u rizier123

4 Comments

Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question.
@Achrome It is an answer, since he copied my answer(deleted now) and posted it.
Okay. Makes sense. I figured your answer was still there.
get with the program achrome he deleted it for some reason

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.