Msg#: 3609369 posted 1:15 pm on Mar 26, 2008 (gmt 0)
Several remarks here: * in preg_replace() you must escape the "/" char in the closing html tags : <\/span> * in the example text you have a "space" between the </span> and the next <a >. The correct RE for preg_replace looks like this: "/<span class=a>(.*?)<\/span>\s*<a class=fl(.*?)<\/a>(.*?)<a class=fl(.*?)<\/a>/is" * The way the replace function work, it will replace the whole RE with "hello world". Not the (.*?).
If you need to extract some information from the code, you should use preg_match() or preg_match_all(), and work with the "matches" array.