开发者

Problem with regexp trailing space

I'm currently modifying Liquid Framework (http://github.com/tobi/liquid) in order to make开发者_如何学Go it support literals.

It's all nice and cool but I'm having a slight problem with the regexp I'm using. The following works great, except the fact that it captures the trailing space in $1

"{{{gnomeslab }}}" =~ /^(?:{{{\s?)(.*)(?:}}})$/

Puts the following value in $1

"gnomeslab "

In order to avoid the temptation of using a right trim, it would awesome if someone from StackOverflow could give me a hand with this patch ;)

Best regards, DBA


/^(?:{{{\s*)(.*?)(?:\s*}}})$/
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜