G
Gavin Kistner
I thought that all four of the following puts statements should be
the same (except for the leading indentation). My intent was for
match_indented to match either case. I particularly don't understand
why the first puts fails.
Do I need more coffee? (Or rather, do I need to start drinking coffee?)
flat = <<ENDSTR
Hello
{{{
Sweet contents.
}}}
World
ENDSTR
indented = <<ENDSTR
Hello
{{{
Sweet contents.
}}}
World
ENDSTR
match_block = /^\{\{\{\n(.+?)\n\}\}\}\n/m
match_indented = /^( |\t)*\{\{\{\n(.+?)\n\1\}\}\}\n/m
puts flat[ match_block, 2 ]
puts flat[ match_indented, 2 ]
puts indented[ match_block, 2 ]
puts indented[ match_indented, 2 ]
#=> nil
#=> nil
#=> nil
#=> Sweet contents.
the same (except for the leading indentation). My intent was for
match_indented to match either case. I particularly don't understand
why the first puts fails.
Do I need more coffee? (Or rather, do I need to start drinking coffee?)
flat = <<ENDSTR
Hello
{{{
Sweet contents.
}}}
World
ENDSTR
indented = <<ENDSTR
Hello
{{{
Sweet contents.
}}}
World
ENDSTR
match_block = /^\{\{\{\n(.+?)\n\}\}\}\n/m
match_indented = /^( |\t)*\{\{\{\n(.+?)\n\1\}\}\}\n/m
puts flat[ match_block, 2 ]
puts flat[ match_indented, 2 ]
puts indented[ match_block, 2 ]
puts indented[ match_indented, 2 ]
#=> nil
#=> nil
#=> nil
#=> Sweet contents.