Interactive ruby ready.
> time = /\A(?<hours>(0\d|1[0-9]|2[0-3])):(?<minutes>([1-5]\d|0\d))\Z/
=> /\A(?<hours>(0\d|1[0-9]|2[0-3])):(?<minutes>([1-5]\d|0\d))\Z/
> match = time.match '11:30'
=> #<TypeError: can't dump MatchData>
I am trying to run the code but getting error as above. What the wrong I did with the regexp help me to improve it.
EDIT
> time = /\A(0\d|1[0-9]|2[0-3]):([0-5]\d)\Z/
=> /\A(0\d|1[0-9??]|2[0-3])??:([0-5]\d)\Z/
> time.match('11:30')
=> #<TypeError: can't dump MatchData>
>
It should be working, and the example you linked to does work on my machine. The regex is needlessly complicated, though:
is enough.
However, it appears that somewhere in your environment, extra bytes have become embedded in the string(s), and these bytes confuse the online tester (which is working correctly). Try and copy the regex from this answer (I have removed the invisible characters) and see if it works for you now.