How to Validate if a String Starts with a Vowel Using Regex in Java? Last Updated : 23 Jul, 2025 Suggest changes Share Like Article Like Report Regular Expressions in Java allow developers to create patterns for matching strings. In this article, we will learn How to Check whether the Given Character String Starts with a Vowel. Example to Check String is Starting with a VowelInput: "Apple"Output: Is a VowelInput: "Cart"Output: Is not a Vowel Program Regex Check whether the Given Character String Starts with a Vowel Let's delve into detailed examples to understand the application of regex for checking if a string starts with a vowel. Java // Java Program Regex Check Whether the // Given Character String Starts with Vowel import java.util.regex.*; // Driver Class public class Temp { // Main Function public static void main(String[] args) { // String Array String[] inputStrings = {"Apple","Bat","Cat","Orange"}; // Regex to check starting character String regexPattern = "^(?i)[aeiou].*"; // Checking all the elements in Array for (String Temp : inputStrings) { if (Temp.matches(regexPattern)) { System.out.println(Temp+" starts with Vowel"); } else { System.out.println(Temp+" does not start with a vowel."); } } } } OutputThe string starts with a vowel. Explaination of the above Program: -^(?i)[aeiou].* is the regular expression used for pattern matching: ^ asserts the start of the string. (?i) enables case-insensitive matching. [aeiou] matches any one of the lowercase vowels. .* matches any sequence of characters (zero or more).The matches method is called on the inputString with the specified regular expression pattern.cIf the input string matches the pattern, it prints "The string starts with a vowel." Otherwise, it prints "The string does not start with a vowel." H hariramesh1893 Follow Article Tags : Java Java Programs java-regular-expression Java-String-Programs Java Examples +1 More Explore Java BasicsIntroduction to Java3 min readJava Programming Basics9 min readJava Methods6 min readAccess Modifiers in Java4 min readArrays in Java7 min readJava Strings8 min readRegular Expressions in Java3 min readOOP & InterfacesClasses and Objects in Java9 min readAccess Modifiers in Java4 min readJava Constructors10 min readJava OOP(Object Oriented Programming) Concepts10 min readJava Packages7 min readJava Interface7 min readCollectionsCollections in Java12 min readCollections Class in Java13 min readCollection Interface in Java4 min readIterator in Java5 min readJava Comparator Interface6 min readException HandlingJava Exception Handling6 min readJava Try Catch Block4 min readJava final, finally and finalize4 min readChained Exceptions in Java3 min readNull Pointer Exception in Java5 min readException Handling with Method Overriding in Java4 min readJava AdvancedJava Multithreading Tutorial3 min readSynchronization in Java10 min readFile Handling in Java4 min readJava Method References9 min readJava 8 Stream Tutorial7 min readJava Networking6 min readJDBC Tutorial5 min readJava Memory Management4 min readGarbage Collection in Java6 min readMemory Leaks in Java3 min readPractice JavaJava Interview Questions and Answers15+ min readJava Programs - Java Programming Examples7 min readJava Exercises - Basic to Advanced Java Practice Programs with Solutions5 min readJava Quiz1 min readJava Project Ideas For Beginners and Advanced15+ min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like