RegExTextField Component

This Echo3 component is a subclass of the abstract class 'ActiveTextField' as described elsewhere.

This components can take two regular expression string, a filter string which is a list of valid input characters. This string is usually delimited with square braces. A second regular express string is used to valid the input and is usually bound by a caret character on the left and a dollar sign on the right which causes the entire input string to considered by the regex matcher.

Demonstration

Allows everything, match anything

characterFilter: .
regexPattern: .

Allows only upper case letters, three consecutive A's to be valid.

characterFilter: [A-Z]
regexPattern: A{3,4}

Allow anything, three X's anywhere to be valid.

characterFilter: .
regexPattern: ([x|X].*){3}

E-mail address. NB: does not validate domain or address

characterFilter: [\\._a-z0-9@-]
regexPattern: ^[_a-z0-9-]+(\\.?[\\+_a-z0-9-]+)*@[a-z0-9-]*(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$

US Government Social Secuity Number

characterFilter: [0-9-]
regexPattern: ^[0-9]{3}\\-[0-9]{2}\\-[0-9]{4}$

Integer with 5 odd digits

characterFilter: [13579]
regexPattern: ^.{5}$

Integer with 5 even digits

characterFilter: [02468]
regexPattern: ^.{5}$

Nonsense filter: a-k, 0-3 or the minus sign; All input is valid.

characterFilter: [a-k0-3-]
regexPattern: .

RegExTextField - Summary API

                   
    package org.informagen.echo.app;
    
    import org.informagen.echo.app.ActiveTextField;
    
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    
    
    public class RegExTextField extends ActiveTextField {
    
        public RegExTextField() 
        public RegExTextField(String filter, String regex) 
    
        public boolean isValid() 
         
        public void setFilter(final String filter) 
        public String getFilter() 
    
        public void setRegEx(final String regex) 
        public String getRegEx() 
    
    }