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.

Similar Messages

  • Regular expression - escape characters

    Hi. Is there an escape character for "?", "[", "]", "{", "}" for regular expression? I tried to do the following: "[^[]?{}]*" (the string cannot contain a question mark, left or right bracket, or left or right curly brace). However, I get an error stating unexpected character.
    thanks,
    Paul.

    Hi. Is there an escape character for "?", "[", "]",
    "{", "}" for regular expression? I tried to do the
    following: "[^[]?{}]*" (the string cannot contain a
    question mark, left or right bracket, or left or right
    curly brace). However, I get an error stating
    unexpected character.
    You should only have to escape the characters that cause a problem in the character class, rather than everything so the following should work.
    "[^\\[\\]?{}]*"

  • Can somebody help me in getting some good material for Regular Expressions and IP Community list

    can somebody help me in getting some good material for Regular Expressions and IP Community list

    I'm not sure what you mean by "IP Community list", but here are 3 reference sites for Regular Expressions:
    Regular Expression Tutorial - Learn How to Use Regular Expressions
    http://www.regular-expressions.info/tutorial.html
    Regular Expressions Cheat Sheet by DaveChild
    http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/
    Regular Expressions Quick Reference
    http://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm

  • 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

  • Java parser for regular expression to java program

    Hi All,
    I am very new to parser technologies .I am looking for a (java)parser which can read the "regular expression" and can convert it into "java program".Please let me know is there any thing related to this.
    Thanks in advance.
    Your will be appriciate.
    Regards,
    Sai.

    Hi Jos,
    Thank you for your quick response .You're welcome.
    If you have any sample code or simple example for how to use those
    classes (Pattern,Match) ,will you please send me .It will be helpful for me.Jverd gave you two nice links already in his reply #3
    If there is any "open source" for parsering regular expressions.
    Please send me I am very new to parser technologies.Note that that Pattern class take care of all the parsing of REs, i.e. there's
    nothing 'interesting' left for you to do any parsing whatsoever. Can you
    elaborate a bit on what you exactly want to do and learn?
    kind regards,
    Jos

  • 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 + "}";

  • 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

  • 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...

  • 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.

  • Please recommend a good tutorial for Regular expressions?

    I have several PERL programs that I need to translate in to JAVA for performance reasons. Those programs heavily use Regular Expressions. I have an excellent knowledge about PERL Regular Expressions but know very little about Java Regular Expressions.
    So Can any one of you recommend me a good tutorial for Java Regular Expressions.
    Thankx In Advance
         LRMK

    Since you know regexs, the java.util.regex.Pattern class API is probably all you need, it pretty thoroughly documents Java's flavor, and the differences from PERL's flavor.

  • Back reference for regular expressions on "Search & Replace".

    Can't I reference a result from my Regular Expression used on "Search Clause" into my "Replace Clause"?
    What I'm doing is:
    Using JDev 10.1.3 DP,
    Search Menu -> Replace in Files...
    Select "Regular Expressions"
    Text: (A[0-9]*?_)(.)
    Replace with: $2 (reference to the second Parenthesis in the "Text" Field).
    For example, in Java, I would so something like this:
    "Dummy String".replaceAll("(D.*? )(S)", "$2");
    Are there any other ways that I can just Search something and Replace for nothing? I need a simple "Search and Delete", you know?
    If I don't do that and try to leave it blank, a warning comes up saying that the "Replace with" field cannot be blank.
    Any sugestions?

    BOUNCE!
    Please, anyone?
    Will I really have to delete 1200 occurrences by hand???
    :(

  • 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

  • Mining for regular expressions from text

    Hi all
    I have a situation where I need to develop a set of regular expressions from lists.
    I have lists of files uploaded and downloaded, and when the event happened. I need to analyze these and boil them down to a set of regular expressions.
    The regular expressions will be used in the future to check the logs for activities. For example:
    foo*.zip is downloaded every night. Has it been downloaded tonight.
    I am looking for help in analyzing the lists of files and deriving regular expressions to describe them.
    Any ideas?
    Thanks all

    check the url http://java.sun.com/developer/technicalArticles/releases/1.4regex/index.html

  • 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?

  • 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.

Maybe you are looking for

  • Metadata access in Jdeveloper 10g using Oracle 9i

    Hello everyone. I´m using Jdev 10 g (release 3) and im trying to create a database connection in the connections tab (new database conection wizard) and after complete all steps an brownsing the "tables" item in the navigator(connection itens treevie

  • Best way to know correct forecast model - process chain set up with multiple forecast models

    Hi Experts, I need your help in selecting best forecast model for our company. We have some of the models already used for our company, and because of multiple models used it is taking very long time for process chain to finish. There is no existing

  • Chatter in CRM On Demand

    Hello, Does anyone know if Oracle plan on developing or have functionality that is similar to salesforce "Chatter"? If not is this there any partner developed solutions that offer that type of feature? Thanks Ben

  • ME 3400 - Scheduled reload does not occur

    Hi there, we try to schedule a reload during off-pick hours on several ME3400 equipped with "me340x-metroipaccess-mz.122-37.SE1" IOS. Altough the "reload at 03:00" and any other form of this command (such as reload in 333 or reload at 03:00 24 Dec) i

  • Service Request Building Block

    Hello everyone, We are currently evaluating the use of the Service Request for a incident/'alarm" tracking scenario. In this regard, does anyone know if there is a building block configuration guide for this? I was looking in the Best Practices but i