I have a very long string, (say a description of a game divided in tech data, description etc), and I would like to be able to do some str_replace() operation on only one part of it. Example
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]- TECHNICAL DATA -
(some text here)
- SERIES -
1. [!--coloro:red--][span style=\"color:red\"][!--/coloro--]Dynasty Wars[!--colorc--][/span][!--/colorc--] (1989)
2. [!--coloro:red--][span style=\"color:red\"][!--/coloro--]Warriors of Fate[!--colorc--][/span][!--/colorc--] (1992)
- STAFF -
(other text here)
I want to change the red strings with a link. This means I need to trim out od the text the "SERIES" chapter and work on that. And this is my problem: HOW can I do this? is there any kind of regular espression function that puts the matched text into a string? something like
$mytext=get_that_string($the_long_string, "/^- SERIES (.*.) - STAFF -/");retunrning a $mytext stating
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]- SERIES -
1. Dynasty Wars (1989)
2. Warriors of Fate (1992)
- STAFF -[/quote]
(no problem in replacing the names with the links, I can dig that...
I was planning to do this by splitting the string on ^-, and working then on the array that would result from this, but isn't there any faster way? Searched the function list, but all string check functions I found states if the needle is in the haystack, but do not return the needle....
Many thanks for any reply!