Originally posted by yathish Gatty: hi, Regular expression locks up.And it fails to terminate and does not throw any error.Is there some means by which I can exit out when the java util hangs.
As Jesper explained, the above code does not cause the program to "hang". Since Java has no control over whether your computer freezes or not, there is no way it can determine when to exit. Besides, if the computer is locked up, it wouldn't be able to execute the code to make your program exit anyway.
With that said, I suspect there is some other cause of your problem. Can you provide more details about what happens when you run this program. It will probably be helpful if you describe how you run the program (i.e. using an IDE or the command line).