views:

37

answers:

1

Hello guys

I'm currently modifying Liquid Framework (http://github.com/tobi/liquid) in order to make 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

+1  A: 
/^(?:{{{\s*)(.*?)(?:\s*}}})$/
LukeH
Thanks LukeH. You officially saved Liquid literals from a trim ;)
DBA