I have this code from which I like to return an array that holds all hits for patterns that starts with 'some' and ends with 'string'.
$mystr = "this string contains some variables such as $this->lang->line('some_string') and $this->lang->line('some_other_string')";
preg_match_all ("/\bsome[\w%+\/-]+?string\b/", $mystr, $result);
However I like to have all hits that starts with
$this->lang->line('
and ends with
')
Furthermore, I need to have the start and end patterns left out. In other words, I like to see 'some_string' and 'some_other_string' in my resulting array. Replacing 'some' and 'string' straight forward is not working, because of special characters?