Field validation by regular expressions?

Hi everyone,
I just started with SoD and I'd like to ensure that some field values consists of alphabetic characters only (FirstName, LastName...). I failed to create an adequate expression. Is there a possibility to use regular expressions?
TIA
Michael

quote:
Originally posted by:
Luckbox72
The problem is not the Regex. I have tested 3 or 4 different
versions that all work on the many different test sites. The
problem is it that the validation does not seem to work. I have
changed the patter to only allow NA and I can still type anything
into the text box. Is there some issue with useing Regex as your
validation?
Bear in mind that by default validation does not occur until
the user attempts to submit the form. If you are trying to control
the characters that the user can enter into the textbox, as opposed
to validating what they have entered, you will need to provide your
own javascript validation.

Similar Messages

  • ADF Email Validation using Regular Expression

    Hi,
    Wanted to add Email Validation VO search.
    It is working if i put
    <af:validateRegExp pattern="[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}"
                                             messageDetailNoMatch="The value {1} is not a valid email address:"/>However this requires email id to be entered in Capital Letters.
    Tried with below option is not working.
                   <af:inputText value="#{bindings.xxEmail.inputValue}" label="Email"
                                          required="#{bindings.xxEmail.hints.mandatory}"
                                          columns="#{bindings.xxEmail.hints.displayWidth}"
                                          maximumLength="#{bindings.xxEmail.hints.precision}"
                                          shortDesc="#{bindings.xxEmail.hints.tooltip}" id="it5">
                                <f:validator binding="#{bindings.xxEmail.validator}"/>
                                <f:validateLength minimum="6"/>             
                                <af:validateRegExp pattern="[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"
                                             messageDetailNoMatch="The value {1} is not a valid email address:"/>
                            </af:inputText>I got above info from
    ADF Email Validation using Regular Expression
    User don't enter email id Without @ .
    Kindly suggest pattern to achive this.
    Thanks,
    jit
    Edited by: appsjit on Jan 25, 2013 7:08 PM

    The RegEx to check EMail after RFC2822
    [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?There are still some missing parts in the check as not all suffix combinations are allowed, but this is pretty good.
    Timo

  • Validation for regular expressions special characters in java

    Hi,
    I need to validate an user name field to an application while creating that. It has to contain only alpha numerics. can you give me the regular expression and also how to implement that.
    thanks,
    VJ

    Do your own work. Look up the documentation on Pattern and make an attempt at validating a String yourself. Then worry about implementing a GUI on top of that.

  • Item Validation using Regular Expression

    Hi,
    I am trying to apply a Validation to a text field item, with the type as Regular Expression.
    The text input into the field should be in a HH:MM:SS format, ie 05:30:00 (for 5:30am).
    The text I am placing in the 'Validation Expression 2' box is:
    [0-2][0-9]\:[0-5][0-9]\:[0-5][0-9]
    This doesn't seem to work and I get an error message when I enter text in the correct format.
    I have even tried to use other comparisons, for example:
    or
    .{8}
    but these still give me an error message.
    Anyone have any ideas?

    Thanks for your help Flavio, the Regular Expression tool is really helpful.
    When I use this tool to compare strings with my regular expression, I get output = TRUE, which means I'm getting it right, but for some reason when I copy the same Regular Expression syntax into APEX, it doesn't work.
    I try to input correct strings into the field that is validated by the Reg Expr, but it still gives me an error.
    It seems to be something I am doing wrong within the application, but I can't figure out what I'm missing.
    I am creating an Item Level Validation with details:
    Type: Regular Expression
    Validation Expression 1: P23_BUS_DAY_COVERAGE_START
    Validation Expression 2: ^(([0-1][0-9])|(2[0-3])):[0-5][0-9]:[0-5][0-9]$
    Has anyone had similar problems using regualr expression validation in APEX?

  • CFFORM (Flash) Validation with Regular Expressions Not Working

    I am having troubles getting regular expression validation to
    work in a CFFORM. The below code is an extract of a much larger
    form, the first name and last name have a regular expression
    validation...and it doesn't work!
    I'd appreciate any comments/info for help on this, have
    searched high and low on information to get this working...but no
    joy.
    The code is:
    <cffunction name="checkFieldSet" output="false"
    returnType="string">
    <cfargument name="fields" type="string" required="true"
    hint="Fields to search">
    <cfargument name="form" type="string" required="true"
    hint="Name of the form">
    <cfargument name="ascode" type="string" required="true"
    hint="Code to fire if all is good.">
    <cfset var vcode = "">
    <cfset var f = "">
    <cfsavecontent variable="vcode">
    var ok = true;
    var msg = "";
    <cfloop index="f" list="#arguments.fields#">
    <cfoutput>
    if(!mx.validators.Validator.isValid(this,
    '#arguments.form#.#f#')) { msg = msg + #f#.errorString + '\n';
    ok=false; }
    </cfoutput>
    </cfloop>
    </cfsavecontent>
    <cfset vcode = vcode & "if(!ok)
    mx.controls.Alert.show(msg,'Validation Error'); ">
    <cfset vcode = vcode & "if(ok) #ascode#">
    <cfset vcode =
    replaceList(vcode,"#chr(10)#,#chr(13)#,#chr(9)#",",,")>
    <cfreturn vcode>
    </cffunction>
    <cfform name="new_form" format="flash" width="600"
    height="600" skin="halosilver" action="new_data.cfc">
    <cfformgroup type="panel" label="New Form"
    style="background-color:##CCCCCC;">
    <cfformgroup type="tabnavigator" id="tabs">
    <cfformgroup type="page" label="Step 1">
    <cfformgroup type="hbox">
    <cfformgroup type="panel" label="Requestor Information"
    style="headerHeight: 13;">
    <cfformgroup type="vbox">
    <cfinput type="text" name="reqName" width="300"
    label="First Name:" validate="regular_expression" pattern="[^0-9]"
    validateat="onblur" required="yes" message="You must supply your
    First Name.">
    <cfinput type="text" name="reqLname" width="300"
    label="Last Name:" validate="regular_expression" pattern="[^0-9]"
    validateat="onblur" required="yes" message="You must supply your
    Last Name.">
    <cfinput type="text" name="reqEmail" width="300"
    label="Email:" validate="email" required="yes" message="You must
    supply your email or the address given is in the wrong format.">
    <cfinput type="text" name="reqPhone" width="300"
    label="Phone Extension:" validate="integer" required="yes"
    maxlength="4" message="You must supply your phone number.">
    </cfformgroup>
    </cfformgroup>
    </cfformgroup>
    <cfformgroup type="horizontal"
    style="horizontalAlign:'right';">
    <cfinput type="button" width="100" name="cnt_step2"
    label="next" value="Next"
    onClick="#checkFieldSet("reqName,reqLname,reqEmail,reqPhone","new_form","tabs.selectedInd ex=tabs.selectedIndex+1")#"
    align="right">
    </cfformgroup>
    </cfformgroup>
    </cfformgroup>
    </cfformgroup>
    </cfform>

    quote:
    Originally posted by:
    Luckbox72
    The problem is not the Regex. I have tested 3 or 4 different
    versions that all work on the many different test sites. The
    problem is it that the validation does not seem to work. I have
    changed the patter to only allow NA and I can still type anything
    into the text box. Is there some issue with useing Regex as your
    validation?
    Bear in mind that by default validation does not occur until
    the user attempts to submit the form. If you are trying to control
    the characters that the user can enter into the textbox, as opposed
    to validating what they have entered, you will need to provide your
    own javascript validation.

  • EMAIL VALIDATION USING REGULAR EXPRESSIONS

    Hi All,
    I am new to regular expressions and am trying to learn about them.
    As practice I am trying to develop a query to filter out invalid e-mail id's eg:-
      <some-name>.<some-name1>@gmail.com - VALID
      <some-name>_<some-name1>@gmail.com - VALID
      <some-name>@<some-name1>@gmail.com - INVALID
    Lets say the column name is EMAIL_ID
    So I have the expression to validate the email end as follows
       select email from <table-name> where REGEXP_LIKE (EMAIL,'.com$') However i have no idea (wheter it is even possible) to filter out the third email id
    on the condition that it has *2 @*
    Any help regarding this would be welcome

    I would recomend you to look at
    http://psoug.org/reference/regexp.html
    And will you find answers of your questions...
    Shortly my comment to your questions...
    1. [A-Za-z0-9._%+-]Here why is %+- included in the pattern?
    Are they parts of a valid email-id?[char] Indicates a character list; most metacharacters inside a character list are understood as literals, with the exception of character classes, and the ^ and - metacharacters. Yes they are a part of valid email.
    2 +@What is this part doing?
    Is + some kind of concatenate operator to help you combine various expressions?+ is means that Character before Match 1 or more times. Your statement before "[A-Za-z0-9._%+-]" must be exist.
    3 \.Is this used to validate the . as in .com ? Point (.) by himself means One character (whenever which one). By typing \. you want to see exactly point.. \ "takes" from point "command power" and point(.) become simple character.
    4 {2,4}
    Emails end in .com then what is the use of putting this range {2,4}?{m, n}     Match at least m times but no more than n times.
    You want characters after pount in range 2 and 4. i.e. ru, com, az, net and so on...
    Hope this was helpfull for you...

  • Password Validation using Regular Expression

    Please help me wit the regular expression for the password policy mentioned below:-
    The password length should at least be 8 characters. It should be a combination of at least any two of the given sets.
    a. Set of alphabets a-z, A-Z
    b. Set of numerics 0-9
    c. Set of special characters ~!@#$ etc.

    function validatePassword(fieldName,minNumberOfDigits, maxNumberOfDigits) {
    var alphaNumericPattern = "^[a-z0-9/_/$]{" + minNumberOfDigits + "," + maxNumberOfDigits + "}";
    var regExpr = new RegExp(alphaNumericPattern,"i");
    var sourceField = event != null ? event.srcElement:e.target;
    if(fieldName != null && fieldName != "null" && fieldName != "undefined") {
    sourceField = document.getElementById('OrdFrmsessionValidater:form1:passwordField2');
    var message = "Password must be a combination of alphabets and numbers";
    message = message + "\n and must be between " + minNumberOfDigits + " and " + maxNumberOfDigits + " chars.";
    var sourceFieldValue = sourceField.value;
    if(sourceFieldValue.length < minNumberOfDigits || sourceFieldValue.length > maxNumberOfDigits){
    alert(message);
    sourceField.focus();
    return false;
    if (!regExpr.test(sourceFieldValue)) {
    alert(message);
    sourceField.focus();
    return false;
    regExpr = new RegExp("[a-z/_/$]{1}","i");
    if(!regExpr.test(sourceFieldValue)){
    alert(message);
    sourceField.focus();
    return false;
    regExpr = new RegExp("[0-9]{1}","i");
    if(!regExpr.test(sourceFieldValue)){
    alert(message);
    sourceField.focus();
    return false;
    var alphaNumericPattern = "^[a-z0-9/_/$]{" + minNumberOfDigits + "," + maxNumberOfDigits + "}";

  • String validation without regular expressions

    Hello all
    I'm facing a little problem, basically i have to make a method that validates an input String "a name"
    Numbers and symbols are not allowed, but white spaces are.
    The method has to be implemented without the use of JFormattedTextField or regular expressions.
    What i'm doing right now is this:
    public boolean validate(String name){
       char[] arr=name.toCharArray();
        for(Char c:arr){
          if(!Character.isLetter(c)){
           return false;
      return true;
    }That isLetter() method is very useful but it sees the white spaces are "non letters".
    I am a bit lost at this point, i'm trying a lot of methods of String and Character but nothing seems to work
    do you have any advice?
    Thx

    enrico wrote:
    That isLetter() method is very useful but it sees the white spaces are "non letters".
    I am a bit lost at this point, i'm trying a lot of methods of String and Character but nothing seems to work
    do you have any advice?Yes: don't try to do it all in one expression. 'If' statements allow you to use '&&' and '||' to connect expressions, so use them.
    Second: Work out what you want to do BEFORE you start programming.
    In this case, you need to know exactly which characters you want to allow, +and when+ (see baftos' examples above).
    Third:for(Char c:arr){is meaningless (unless you've defined a class called 'Char').
    Accuracy is important.
    Winston

  • Email validation using Regular Expression.

    Hi,
    I am in need of using a regular expression for email valiatino. ^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$ which is gotten from http://www.regular-expressions.info/email.html .
    This works fine in a regular expression test tool http://regexpal.com/ , but when I use in Oracle, it does not.
    DECLARE
    v_exp VARCHAR2(4000);
    BEGIN
       --v_exp := '^[a-z0-9!#$%&''*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$';
       v_exp := '^[a-z0-9!#\$%&''*+/=?\^_`{|}~-]+(?:\.[a-z0-9!#\$%&''*+/=?\^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$';
       dbms_output.put_line(v_exp);
       FOR v_rec IN (
          with test_data as
    ( select '[email protected]'     as val from dual union all
      select '[email protected]'       as val from dual union all
      select 'ad{[email protected]' as val from dual union ALL
      select '[email protected]' as val from dual union all 
      select '[email protected]' as val from dual union all 
      select '[email protected]'      as val from dual union all
      select 'no#good'                  as val from dual
    select
      val ,
      case
        when
          regexp_like
          (val, v_exp,'i') then 'Y'
        else 'N'
        end
        as good
    from test_data ) LOOP
       dbms_output.put_line(v_rec.val||', '||v_rec.good);
    END LOOP;  
    END;   and the results are
    [email protected], N
    [email protected], N
    ad{[email protected], N
    [email protected], N
    [email protected], N
    [email protected], N
    no#good, N
    The expected result should be Y for all but for the last two.
    I am not sure why it is not working in Oracle.
    Can any body please help me to find the mistake and to have it correctly?
    Advance Thanks,
    Natarajan
    Edited by: Nattu on Dec 4, 2012 1:31 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Try this regular expression:
    >> ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$
    >> [email protected], *Y*
    >> [email protected], *Y*
    >> ad{[email protected], N
    >> [email protected], *Y*
    >> [email protected], *Y*
    >> [email protected], N
    >> no#good, N
    [Using a regular expression to validate an email address|http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address]
    Edited by: stefan nebesnak on 4.12.2012 2:25                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Password validation with regular expression

    I'm trying to use a regular expression to validate a password. I've tried a number of different regex's that seem to work elsewhere but do not work in HTML DB. This includes a couple that I wrote and that I found on regex web sites. Specifically, I'm trying to validate that a string has:
    1. at least one special character
    2. at least one numeric character
    3. no more than 6 consecutive characters
    4. has a length between 8 and 14
    Does anyone know why some regular expressions do not work in HTML DB that work elsewhere or has anyone done a regex similar to this in HTML DB.
    Thanks!
    - Brian

    I see, I will use the [0-9] instead. The expression still does not work though. I simplified the expression down to try and figure out what doesn't work and it seems like it's the "?=".
    1. I first entered the expression:
    ([:alnum:]*[0-9])
    This expression just says there must be a number and it works fine in HTML DB.
    2. I extended it to:
    ([:alnum:]*[0-9])([:alnum:]*[a-z])
    This expression says that there must be a number followed by a letter. In this example "1a" works but "a1" does not.
    3. To make it not care about the order I would normally add "?=" like so:
    (?=[:alnum:]*[0-9])(?=[:alnum:]*[a-z])
    This should work for "a1" or "1a" because the ? says the order doesn't matter. When I try this in HTML DB neither "1a" or "a1" work.
    Any ideas?
    Thanks
    - Brian

  • Java validation with regular expression

    Hi
    I need to validate a string such that only numbers, alphabets, -, _, . is allowed and the below mentioned code works fine.
    if( ! l_name.matches("[A-Za-z0-9._-]+" ) ) {
    // do stuff when a valid name is found
    But i need to modify the above regex such that it should also allow space in the name. Any idea how to do that?
    Thanks in advance.

    I tried a space it does not work!!!Then you added the space between a character range or something.
    Here, this is a bit more compact:name.matches("[-.\\w\\s]+")

  • Java input validation with regular expression

    I am trying to make sure the user can only enter numbers 0 - 100, can any of you Java geniuses give me a hint. My regex matches the inputs I want, but when I enter a '9' I encounter an error when I cast the string to a double. Actually the input value is never assigned to the perc variable, but only when the input is a single digit. Here' s the piece of code that's giving me this headache:
    while(!in.hasNext("[0-9]")){
         try {
              perc = in.next("[0-9]{1,2}|100");
              break;
         } catch (InputMismatchException e) {
              System.out.println("Bad Input - Try Again");
              perc = in.next();
    dblPerc = Double.parseDouble(perc);And here's the error:
    Exception in thread "main" java.lang.NumberFormatException: empty String
            at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
            at java.lang.Double.parseDouble(Double.java:510)
            at applicant_database.View.showInput(View.java:46)
            at applicant_database.View.main(View.java:101)

    Add debugging code to your program to see what you're getting.

  • Regular Expression Programmatically from Bean

    Hi,
    I am on JDeveloper 11.1.2.0.0.
    We have few Field validation using Regular Expression.
    eg.
    Number
    [0-9]{1,10}
    or
    Email
    [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}
    Can we fire it from Bean. I need to move these changes to Value Change Listener or Validater
    Thanks,
    Kiran

    Hi Suresh Frank,
    Appreciate your quick response.
    When i tried putting in Value Change Listener it worked.
    I put below code to show error.
                        FacesContext context = FacesContext.getCurrentInstance();           
                        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Email Format is not correct " + valueChangeEvent.getNewValue(), msg);
                        context.addMessage(null,message);  It throws error in popup window. However after clicking ok it is going to next fields and allowing to submit Form.
    My requirement is if value not changed(even though it is in incorrect format) just proceed however if value changed then make sure format is correct and do not allow to proceed.
    Can we achieve this using FacesMessage.
    Thanks,
    Kiran

  • URL validation - regular expression

    Hello,
    I searched but didn´t find.
    I need a simple method: isValidUrl
    I tried "new URL(url)", getting error, but it allows a simple url with space... I tried too org.apache.validator but it brought me problems with related .jar...
    I got one validation for e-mail, that work very well using regex. Does anyone have URL validation using regular expression?
    Thanks.

    ^(http|https|ftp)\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\\\+&%\\$#\\=~])*$
    It seems to work.Are you sure?

  • Regular Expression or Common Validator Utility Class

    Hi all,
    Just to check whether is there a common validator utility class that make use of Regular Expression for input and output validation in Web Dynpro?
    Thank a lot
    Regards

    Hi
    U can make use of following classes for validating a regular expression.
    java.util.regex.Pattern
    java.util.regex.Match
    Regards
    Surender Dahiya

Maybe you are looking for