Reputation: 73
i have bunch of strings, where i need cut out one portion:
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.
and many others. I need remove [looked YYYY m. month dd d.] portion. Which begins with "[looked" and ends with "]". How can i achieve this?
i have tried preg_replace, but i cannot build up great working pattern.
Upvotes: 1
Views: 27
Reputation: 174696
You may try this,
preg_replace('~\[Looked\b[^\]]*\]~', '', $str);
Upvotes: 1