Why won't this ruby regex match this string?
x = "output/file.zip"
x =~ /output\/.\../
returns n开发者_如何学Cil. There is something wrong with escaping the period, but I can't figure it out.
.
usually means "any character" in regex. Try .*
, which means ".
repeated zero or more times":
x =~ /output\/.*\..*/
Works fine for me.
精彩评论