删除 '[img id="123" align="left"]'this 前后的所有文本并获取此 imageid 并删除此 stringi 的其余部分
remove all text before and after '[img id="123" align="left"]'this and get this imageid and also remove the rest part of this stringi
我想删除 '[img id="123" align="left"]'this 前后的所有文本并获取此 imageid 并删除此字符串的其他部分
我的文本:
"For the past couple of years, the 'Melbourne bounce' sound – a fusion of Dutch-style electrohouse, psy-trance and breaks, pioneered in Australia's second biggest city – has been tearing it up at big EDM raves, finding its way into the sets of Laidback Luke, David Guetta and Calvin Harris. And now THE ONE has brought out a double-pack for any aspiring producers wanting to get in on the Melbourne bounce action.
The Melbourne Bounce Bundle, as its imaginatively titled, consists of Melbourne Leads and Bounce Melodies. The former consists of 50 presets for Native Instruments Massive, while the latter contains 100 MIDI loops, geared mostly towards lead synths, and 62 WAV loops from the two demo songs. In total, you get 120MB of sounds to play with.
[timg id="55" align="left"]
The bundle is available now via Beatport, priced £15.95
Find out more: Beatport"
$patterns = array();
$patterns[0] = '@(^.*?".*?".*?)\[timg id="(.*?)" align="left"\](.*)@';
$replacements = array();
$replacements[0] = "";
preg_replace($patterns, $replacements,$Story_Textarea);
这里,storytextarea = my text
您需要将preg_replace的结果赋给一个变量:
$result = preg_replace($patterns, $replacements, $Story_Textarea);
echo $result; // prints 55 with your sample text.
我想删除 '[img id="123" align="left"]'this 前后的所有文本并获取此 imageid 并删除此字符串的其他部分
我的文本:
"For the past couple of years, the 'Melbourne bounce' sound – a fusion of Dutch-style electrohouse, psy-trance and breaks, pioneered in Australia's second biggest city – has been tearing it up at big EDM raves, finding its way into the sets of Laidback Luke, David Guetta and Calvin Harris. And now THE ONE has brought out a double-pack for any aspiring producers wanting to get in on the Melbourne bounce action. The Melbourne Bounce Bundle, as its imaginatively titled, consists of Melbourne Leads and Bounce Melodies. The former consists of 50 presets for Native Instruments Massive, while the latter contains 100 MIDI loops, geared mostly towards lead synths, and 62 WAV loops from the two demo songs. In total, you get 120MB of sounds to play with. [timg id="55" align="left"] The bundle is available now via Beatport, priced £15.95 Find out more: Beatport"
$patterns = array();
$patterns[0] = '@(^.*?".*?".*?)\[timg id="(.*?)" align="left"\](.*)@';
$replacements = array();
$replacements[0] = "";
preg_replace($patterns, $replacements,$Story_Textarea);
这里,storytextarea = my text
您需要将preg_replace的结果赋给一个变量:
$result = preg_replace($patterns, $replacements, $Story_Textarea);
echo $result; // prints 55 with your sample text.