php字符串操作问题
字符串:{user:link islocal='1'} /2013/userup/100/131a2Z34-5N8.doc {/user:link}
如何取出131a2Z34-5N8字符串???
比如有很多类似的字符串:
字符串1:{user:link islocal='1'} /2013/userup/100/131a2Z34-800.doc {/user:link}
字符串2:{user:link islocal='1'} /2013/userup/100/131a2Z34-801.doc {/user:link}
字符串3:{user:link islocal='1'} /2013/userup/100/131a2Z34-802.doc {/user:link}
分别取出字符串:
131a2Z34-800
131a2Z34-801
131a2Z34-802
要用正则吗,如何实现?
[解决办法]
$s=<<<txt
字符串1:{user:link islocal='1'} /2013/userup/100/131a2Z34-800.doc {/user:link}
字符串2:{user:link islocal='1'} /2013/userup/100/131a2Z34-801.doc {/user:link}
字符串3:{user:link islocal='1'} /2013/userup/100/131a2Z34-802.doc {/user:link}
txt;
preg_match_all('#/([^/]+)\.doc\s*{/user#sU',$s,$m);
print_r($m[1]);
preg_match_all('#/([^/]+?)\.#',$s,$m);
print_r($m[1]);