本文介绍了URL和preg_match(再次)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 好的,我找到了一段时间帮忙(2002年10月9日)到 的线程给我这样的模式: `( ?((F | HT)TP://)(?([^ @:] +)([^ @] +)@)([^:\ /])+(:\d +)(\\ \\ / [^ \ s] +)?)`i 好​​的,这一切都很好用,直到在结尾处使用URL为止 sentance。我假设某种程度上我需要一个负面的预测, 但是我无法绕过这一个... 想要只匹配网址... $ string =" ... http://www.example.com." ;; $ string =" ... http://www.example.com/." ;; $ string =" ... http://www.example.com/page1.html? " ;; $ string =" ... http://www.example.com/info.php?id=4 !" ;; 等.. 当我不想要它时,上面的模式是从每个字符串中拉出最后一个字符。不幸的是,URL可以_anything_有效,而我不会控制它的输入方式。任何人都可以帮忙吗? TIA - Justin Koivisto - sp ** @ koivi.com PHP海报:请使用comp.lang.php获取与PHP相关的问题, $ b不建议使用$ b alt.php *组。 SEO竞赛联盟: http://seo.koivi.com/ OK, I found a thread that help out from a while back (Oct 9, 2002) togive me this pattern: `(((f|ht)tp://)(([^@:]+)([^@]+)?@)?([^:\/])+(:\d+)?(\/[^\s]+)?)`i OK, all is well and good with this until the URL is used at the end of asentance. I am assuming that I will need a negative lookahead somehow,but I just can''t wrap my mind around this one... Want to match only the URL... $string="... http://www.example.com.";$string="... http://www.example.com/.";$string="... http://www.example.com/page1.html?";$string="... http://www.example.com/info.php?id=4!";etc... The pattern above is pulling the last character from each string when Idon''t want it. Unfortunately, the URL can be _anything_ valid, and Idon''t have control of how it will be input. Can anyone help with this? TIA --Justin Koivisto - sp**@koivi.comPHP POSTERS: Please use comp.lang.php for PHP related questions,alt.php* groups are not recommended.SEO Competition League: http://seo.koivi.com/推荐答案 这篇关于URL和preg_match(再次)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 04:15