Ruby Does My Regex not Match

August 26, 2014

Since learning Ruby, I have had to become comfortable with using the command line, the syntax and regex. I am not a big fan of regex, since working on C# I can single handily count how many regexes I have written. In the Ruby world, however, authoring regexes is part and parcel of everyday life.

Tonight I was playing around with my regexes but couldn’t find a way for Ruby to tell me when it couldn’t find a file that was asked for.

Tonight I found this of code that I hope will go a long way in solving my needs. This code will tell you whether or not a string value matches what is used in a regex.

'x' !~ /x/

This is awesome. With a simple regex, I am able to get a lot of mileage out of the code I have written.

This is an exciting time for me and what better time to write some good rock-solid code.

I was also super tired writing this, so if none of this makes sense I appologies.


Discussion, links, and tweets

My name is Deon Heyns and I am a developer learning things and documenting them in realtime. Python, Ruby, Scala, .NET, and Groovy are all languages I have written code in. I appeared in the New York Post once. I host my code up at GitHub and Bitbucket so have a look at my code, fork it and send those pull requests.

comments powered by Disqus