开发者

How can I extract all text between brackets in a PHP DocComment?

开发者 https://www.devze.com 2023-01-28 01:33 出处:网络
Let\'s say my DocComment looks like this: /** *[Test] *[AnotherTest] */ What I want to end up with is an array that contains \"Test\" and \"AnotherTest\"

Let's say my DocComment looks like this:

/** 
 *  [Test] 
 *  [AnotherTest]
 */

What I want to end up with is an array that contains "Test" and "AnotherTest"

I know how to retrieve the DocComment using Reflection, I'm just not sure how I can parse those values out 开发者_JAVA百科cleanly. What is the best way to achieve this?


well the following regex should work:

/\[(.*?)\]/ 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号