I got stuck in another situation: our users enter a text to be stored in a variable. The condition for that text is it can be allowed to enter only 25 characters, Now I have to write a regular expression which will check the condition, kindly help me out in this.
Share
I think you could just use the String#length method…
http://ruby-doc.org/core-1.9.3/String.html#method-i-length
Example: