kindly help with my java regex issue | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

kindly help with my java regex issue

Hi Guys, I am trying to learn regex for the first time in java. I am facing with the below issue: import java.util.regex.Pattern; public class Snippet { public static void main(String[] args) { String S = new String("hellowordl"); System.out.println(S.matches("[a-zA-Z]")); } } i want to check my string to see if all the characters are alphabet. i want to use regex to do this. kindly let me know what i am doing wrong here. the output is "false" right now.

20th Feb 2017, 12:34 PM
nirmal kumar vaidhyanathan
nirmal kumar vaidhyanathan - avatar
1 Answer
0
thanks Moksh for ur help. :)
20th Feb 2017, 2:37 PM
nirmal kumar vaidhyanathan
nirmal kumar vaidhyanathan - avatar