我有一串弦,我需要剪掉一部分:
1. Adaptation of a one-step worst-case optimal univariate algorithm of bi-objective Lipschitz optimization to multidimensional problems, vol. 21 [looked: 2014 m. september 15 d.], p. 89-98.
2. On benchmarking stochastic global optimization algorithms, 2014 [looked 2014 m. spetember 17 d.], p. 9-12.
3. Quadratic programming with complementarity constraints for multidimensional scaling with city-block distances, Vol. 2, no. 4 [looked 2014 m. december 05 d.], p. 248-259.
还有很多其他人。我需要看一下YYYY m月dd .部分。它以“查找”开头,以"“结尾。我怎样才能做到这一点?
我尝试过preg_replace,但是我不能建立一个很好的工作模式。
发布于 2015-10-28 23:31:53
你可以试试这个,
preg_replace('~\[Looked\b[^\]]*\]~', '', $str);
发布于 2015-10-28 23:34:13
这样做是可行的:
preg_replace("/\[looked(.+?)\]/","",$str)
https://stackoverflow.com/questions/33408255
复制