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

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -