When you get stuck in an IRB, this is usually due to an unsurpassed closing delimiter, such as a single quote that does not match a double quote.
For this particular question, this is because it is in a Regexp object, the separator of which is the "/" that you pressed. This is identical in action to the fact that the open quote does not close. Once you finish the slash to close Regexp, you will find yourself in the next prompt, and you will see some return from the IRB on the line to your cursor location. Thus, it is advisable to simply close the separator.
Perhaps this can only be a fishing expedition, you should ignore the return at the end of the line instead, and when you should use the backslash ('\'), did you use the slash?
Control-C looks heavy as it tries to send an interrupt. Control-D is the EOD character or end of the data * and therefore, as a rule, the IRB knows that you have entered data in a string (or stream).
This works not only with IRB, but can take you out of rather difficult places without interrupting the application that works. Allows you to have an elegant exit or even continue to work with the program and correct your error, for example, sometimes in IRB.

Of course, if that doesn't work, try control-c , it will most likely be heavy enough to be missed.
* : historically , EOT or "End of tape" or "End of transfer". Maybe itโs just that I mnemonically treat โdataโ as an input stream.
source share