I'm trying to create a single instance of a regex term.


boolean rProcessEndpoint = Pattern.matches("[http://]{1,1}", processEndpointInput);

However, with this particular instance, you can type "http://http://" and it will return true.

Here is my source of information:
Here is where I test my regex:


Take a look at char class,

boolean rProcessEndpoint = Pattern.matches("http://", processEndpointInput);


Even with this expression, you can still type "httphttp" and get "true".

"://" you don't get this into account

String processEndpointInput = "http://http://";
        for (int j = 0; j < processEndpointInput.length(); j++) {
            int c = processEndpointInput.charAt(j);
            System.out.println(processEndpointInput.charAt(j) + " hexal code= " + Integer.toHexString(c));
        //  boolean rProcessEndpoint = Pattern.matches("(http...)+", processEndpointInput);
        //  boolean rProcessEndpoint = Pattern.matches("(http[^\\w][^\\w][^\\w])+", processEndpointInput);
        //  boolean rProcessEndpoint = Pattern.matches("(http\\x3a\\x2f\\x2f)+", processEndpointInput);
        //  boolean rProcessEndpoint = Pattern.matches("(http\\x3a\\x2f\\x2f){1,2}", processEndpointInput);
        boolean rProcessEndpoint = Pattern.matches("(http\\:\\/\\/)+", processEndpointInput);
        System.out.println("" + processEndpointInput);
        System.out.println("." + rProcessEndpoint);

with these examples I hope you should do the url excercise by yourself

^(https?://)?(([\w!~*'().&=+$%-]+: )?[\w!~*'().&=+$%-]+@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([\w!~*'()-]+\.)*

I don't really understand what you're saying quuba.

adatapost - Thanks, but that doesn't work.