using regex validator against a field containing a 4 digit number (hour and minute of day), number is '1446', using ^[0-9][0-9][0-9][0-9] and it is failing. when i try the same in https://www.freeformatter.com/java-regex-tester.html#ad-output or in python 're' module, e.g. it works.
Dear @rob.zimmelman ,
I have no answer for your question, but dose this RegEx work?
[0-2][0-9][0-5][0-9]
I have proved this RegEx with following Java code:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
Pattern pattern = Pattern.compile("[0-2][0-9][0-5][0-9]", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher("1446");
boolean matchFound = matcher.find();
if(matchFound) {
System.out.println("Match found");
} else {
System.out.println("Match not found");
}
}
}
So long
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
accomplished what i needed by making a sql query for GETDATE() which worked in the query comparison where the string comparison i was doing in regex with the string returned from an endpoint that returned 'hhmm' wasn't working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.