3
x = "output/file.zip"

x =~ /output\/.\../

returns nil. There is something wrong with escaping the period, but I can't figure it out.

1
  • 1
    You can use rubular for testing your regular expressions. Commented Feb 18, 2011 at 19:51

1 Answer 1

5

. usually means "any character" in regex. Try .*, which means ". repeated zero or more times":

x =~ /output\/.*\..*/

Works fine for me.

Sign up to request clarification or add additional context in comments.

1 Comment

You can also use .+ which means ". repeated one or more times"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.