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*}}})$/
精彩评论