What is a regular expression for finding a string with pattern ALXXXXX in another string?
I want to search for a template string ALXXXXX inside another string.
For example, I want to find line AL00123 in the line Data Stage AL00123
I've tried the following in Java.
Pattern pattern = Pattern.compile("AL\\d\\d\\d\\d\\d");
Matcher matcher = pattern.matcher(searchString);
boolean matches = matcher.matches();
this always returns false. What's wrong with my code?
I want to achieve the following
- Determine if the search string contains ALXXXXX.
- Get ALXXXXX value.
- I want to do this in Java.
Listed below are the different ways to use ALXXXXX in any of the following ways:
- Data Stage_AL00123
- Data Step AL00123
- Data Stage (AL00123)
- Data Stage (_AL00123)
- Data StageAL00123
Finally
- The line always starts with AL
- The string will always contain 5 digits after AL
+3
source to share