Why won't this ruby regex match this string? -
x = "output/file.zip" x =~ /output\/.\../
returns nil. there wrong escaping period, can't figure out.
.
means "any character" in regex. try .*
, means ".
repeated 0 or more times":
x =~ /output\/.*\..*/
works fine me.
Comments
Post a Comment