Hi,
I am trying to use regex to validate an input from JOptionpane i want to allow the user entering ONLY digits, letters and exclametion marks.

This is my line of code where i would like to put teh regex.

Code

String message = JOptionPane.showInputDialog(null, "Enter a Message: ");
Steganography.hide(message, imageChoosed);
lblPictureChoosed.setIcon(new ImageIcon(imageChoosed));


I would like to put the validation on String message.

"\\d"

correct way: create JDialog put there JFormattedTextField with NumberFormatter

Is your question how to use the regEx or where to do the validation?

Is your question how to use the regEx or where to do the validation?

Actually i figuerd out that i have to do a class that is the request to check the string from the jOptionPane.. What should i do pls

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.