Regular Expression Validator problem

Hello
I have a text box that I want to use a regular expression validator to check that one or more 9 char alphanumeric serial numbers have been entered.
< mx:RegExpValidator
source = "{entryField}.
property = "text".
Flags = "IM".
expression="{/[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9] ({|, | \\n|\\r|\\t)/} ')
valid = "handleResult (Event)" "
Invalid = "handleResult (Event)" "
trigger = "{entryField}.
triggerEvent = "textInput".
/ >

for the test
private void handleResult(eventObj:ValidationResultEvent):void {}
If (eventObj.type is ValidationResultEvent.VALID)
{
entryField.setStyle ("borderColor", "green");
entryField.setStyle ("largeurBordure", "2");
}
on the other
{
entryField.setStyle ("borderColor", "red");
entryField.setStyle ("largeurBordure", "2");
}
}

The problem is the handler function always comes back valid, even when it must be valid, as: 123456789 a12345678 lk231jkop

Can anyone tell where I go wrong? Thank you!

I finally got it works like this:
triggerEvent = "keyUp".
expression = "^ ([A-Za-z0-9] {9} \ (|, |))" \n|\r)*)+$ »

The big takeaway from this is that the textInput event does NOT work as advertised. Specifically, it does not occur during a deletion. In addition, it forces me to add a space at the end of a serial number using the above expression so that the validation is successful. Fortunately, 'keyUp' works very well :-)

Tags: Flex

Similar Questions

  • Regular Expression validation

    Hi all
    I use Jdev 11 g Release 1. I have a field inputText to which I added 'validate reg exp' operation. The model is [a-zA-Z].
    He wishes however to default validation when I enter all the letters. For example, "hut" fails, and the 'REFUGE' also fails.
    Any suggestions?

    < af:inputText label = "#{ebundle.» ID ENTITY_FIRSTNAME_LABEL}"="slr_it_firstName. "
    Binding = "#{pageFlowScope.Form6Part2Bean.seller.Person.FirstName}" columns = '20' maximumLength = "20" > ""
    < af:validateRegExp pattern = "[a-zA-Z].
    messageDetailNoMatch = "No licensed figures" / >
    < / af:inputText >

    Try [a-zA-Z] * [a-zA-Z]

    Amit

  • Regular expression as part of the page

    Hello

    I m doing a page using regular Expressions validation step, but my regular Expression is dynamic. I have another page element called VL_REGEXP where I put a value to the regular expression.

    But when I write VL_REGEXP as a validation expression, he doesn´t the test condition. It tests only when I put the value of the regular expression.

    So, what I would do to this dynamic Regular Expression for validation?

    Example of my settings:

    -Doesn´t work

    Type of validation:

    Point / 1 expression column matches a regular Expression in the Expression 2

    Expression 1

    P12_CD_ACCOUNT

    Expression 2

    P12_VL_REGEXP -that's what I need!

    -It works

    Type of validation:

    Point / 1 expression column matches a regular Expression in the Expression 2

    Expression 1

    P12_CD_ACCOUNT


    Expression 2

    ^ (\d\d\.\d\d\d\.\d)+$

    Thank you

    Bsalvador

    Don't know if the required substitution treatment is supported in the validation expression, but if it is you need to reference the page element using the syntax of static text substitution:

    Type of validation:

    Point / 1 expression column matches a regular Expression in the Expression 2

    Expression 1

    P12_CD_ACCOUNT

    Expression 2

    & P12_VL_REGEXP.

  • problem with the validation type: regular expression

    Hi all
    I have a text field element call p40_opt
    in the past, this element could accept only the values 1-9
    I made a posting type: regular expression
    1 validation expression:
    p40_opt

    2 validation expression:
    [1-9]

    works very well.

    Today, I wanted to add an option that p40_opt can also contains the value: 10
    so I changed the range [1-10].

    and now, it's not good because if I choose another option plus 1 and 10 to Ant

    he do the validation.

    what I'm missing here?
    Thanks in advance

    Under the direction of: naama on August 6, 2009 01:31

    The forum software has mutilated regular expressions in your message. You should edit, wrapping up the regular expressions in.

     tags so they are properly displayed.
    

    ^ [1-9] {1} $. ^ $ 10

    would be one regular expression that performs the required validation, however a regular expression doesn't appear to be the most straightforward way to validate such a range of values. A SQL or PL/SQL validation would be clearer, using the expression:
    

    : p40_opt between 1 and 10

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • Validation using regular expressions or oracle fn

    Hello

    I want to apply validation to a column. I'm trying to see if I can use the regexp_replace function to find a boss and see if I can replace it to a better format. Can someone help me with these rules?

    1. only the characters a - z, A - Z, 0-9, ', - is allowed. If there are no other characters, then these characters must be removed.

    2. name should not begin with a symbol.

    3. If there is any symbol permitted in the name, (for example the hyphen) then the hyphen should be preceded and followed by a space.

    I would like to know if the above can be obtained by regular expressions or any other function will be useful to achieve the same.


    Thank you very much

    Cherkaoui

    HI, Charan,

    Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

    Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.  Post in this case, maybe 5 or 10 strings, and what you would like to see (a string corrected, or a 'yes' / 'No' flag saying if this string follows rules.)

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    2784427 wrote:

    Hello

    I want to apply validation to a column. I'm trying to see if I can use the regexp_replace function to find a boss and see if I can replace it to a better format. Can someone help me with these rules?

    1. only the characters a - z, A - Z, 0-9, ', - is allowed. If there are no other characters, then these characters must be removed.

    2. name should not begin with a symbol.

    3. If there is any symbol permitted in the name, (for example the hyphen) then the hyphen should be preceded and followed by a space.

    I would like to know if the above can be obtained by regular expressions or any other function will be useful to achieve the same.

    Thank you very much

    Cherkaoui

    Sorry, we don't know what you want to do.

    1 seems to mean you want to change the given string so that it follows the rules.  (What exactly are special characters?  Are there only 2 special characters: single quotation mark and hyphen?)

    2 seems to tell us that you want to check if it meets the rules

    3. can be a

    I'll assume that you want to modify the string so that the returned value corresponds to rules.  This means that if the given string violates, 2 symbols will be removed from the beginning of the string, and if it violates 3, then spaces will be added.

    I don't think that there is a way to do this with a regular expression.

    You can make each with a separate REGEXP_REPLACE corrections, and make all in the same query by one nesting inside each other, like this:

    SELECT REGEXP_REPLACE (REGEXP_REPLACE (REGEXP_REPLACE (: str)))

    , "[^ a-zA-Z0-9 cm-]"

    )

    , '^[''-]+'

    )

    , ' *([''-]) *'

    , ' \1 '

    ) AS new_str

    OF the double

    ;

    of course, I can't test it, until post you some sample data and the exact results you want from these data.

    Here, the inner REGEXP_REPLACE rule 1 applies.  It deletes all characters except a to z small letters, capital letters A to Z, numbers, spaces, single quotes and hyphens.

    Rule 2 applies the REGEXP_REPLACE middle.  It removes the single quotes and hyphens that appear at the beginning of the string.

    The external REGEXP_REPLACE rule 3.  It guarantees that each single quotation mark or a hyphen is preceded and followed by a space.  If there is already a space (or several spaces) before and/or after the special symbol, they are replaced by a single space.  If this isn't what you want, it can be fixed, but it will make the expression even messier.

    You might consider to write a user-defined function to normalize strings.  In a function procedure, you can apply the rules one after the other. you need not nesting complicated like that.  Of course, a user-defined function will be slower, but maybe it's not a problem.

    Still, the above query converts the string so that the production rules.

    If you just want to check whether a string conforms to the rules, you can compare the original string to the output of the above expression.  If they are identical, then the string is in accordance with the rules.

  • Regular expressions in the field of Validation does not.

    I really hope someone can help me.  I'm quite familiar with regular expressions, but for some reason, I can't it to work.

    Environment: Windows XP

    Adobe Acrobat version 8.12

    Scenario:

    In a text field of the form, the user enters a full path.

    This is the code that runs when the user leaves the field:

    / * Test alternatives

    var validChars = / ^ \w [:\\]$/
    var validChars = / ^ \w :\\$/

    var validChars = / ^ [A - Z] [a - z] [0-9] [:\\_]$/

    */


    var validChars = / ^ [A-Za-z0-9 :\\_]$/

    If (event.value! = "")
    {
    If ((event.value) validChars.test is false)
    {
    App.Alert ("Invalid character.  Only alphanumeric, colon, underscore, backslask and spaces are valid characters. ») ;
    Event.RC = false;
    }
    }

    The characters allowed in the path are: alphanumeric, underscore, colon, backslash (\), and space.

    I tried all the expressions above with c:\aoa_apps and they all fail: alert the invalid character appears.

    I've added alerts to print the event.value and that seems to be ok.

    I tried all of them with c:aoa_apps and they still fail.  Finally, I tried caoa_apps and they still aren't.

    I checked each of the expressions in a small validator of expression that I have and they seem to be ok.

    I'm cross-eyed looking for a reason why it's a failure.   So, apparently, that I do something stupid, again, I'm new to scripting Adobe Acrobat.  But for the life of me, I can't.

    Can anyone spot the problem?

    Any help is greatly appreciated.

    caerial.

    How you set up your regexp, only the first character is tested. Try

    place a * before the $.

  • Validation of attribute text WITHOUT using regular expressions

    Hello world

    I'm working on a few validation rules for a text attribute and one of the conditions is that the text string can contain only alphanumeric characters.

    Because of the requirements that I can't use a regular expression here (the output should be a Boolean value confirming if the text is valid or not), so I need to find a way to write this in the rules...

    Yes, is there an easier way of writing this rule that the use of the ' Contains (< text >, < substring >)' function? Like this:

    piccy1.png

    [Etc. for all the non alpha numeric characters]

    If not, is it possible to write a rule that States that the text contains ONLY the following characters

    piccy2.png

    [Etc for all alphanumberic characters]

    Or is there some other function I could use it here?

    Appreciate any thoughts or input about how this could be solved, thank you in advance for your help.

    Unfortunately, regular expressions are the ideal solution for exactly the scenario you are exhibitor. The only alternative other than a broad 'or' statements is regular expressions, or write a custom function.

  • The regular expression problem

    Dear friends,

    In my script I have some sections that test the contents of an edit field before it is processed further.

    Perfectly things like the following:

    var re_Def = /#[A-Za-z][A-Za-z0-9_]+/;          // valid variable name ?
    items = ["#correct", "notcorrect", "#This_is4", "#thisIs", "@something", "#ALLOK", "", ];
    // search    0            -1          -1!!        -1!!          -1        -1!!     -1      <--- incorrect method
    // test    true         false         true        true        false       true    false    <--- correct method
    for (var j = 0; j < items.length; j++) {
      var item = items[j];
      alert ("'" + item + "' ==> " +  item.search(re_Def) + "\n" + re_Def.test(item));
    }
    var re_Def = /(\[ROW +\d+\]|\[COL +\d+\]|\[CELL +\d+, +\d+\]|Left *\(\d*\)|Right *\(\d*\)|Above *\(\d*\)|Below *\(\d*\))/;
    items = ["[ROW 17]", "[Row n]", "[ROW n]", "[CELL 3, 9]", "[CELL 3 9]", "Abbove()", "Right(3)"];
    // result  true        false      false         true         false        false         true    
    for (var j = 0; j < items.length; j++) {
      alert ("'" + items[j] + "' ==> " +  re_Def.test(items[j]));
    }
    

    But what follows always returns false, independly of the content of the string element:

    var re_Def = /{[EFJ]\d*}|{I}/;    // valid format def?
    var item = "{E27}";
    var result = re_Def.test(item);
    alert (result);                   // false !!
    

    RegEx buddy told me, that
    -l' REGULAR expression is correct
    -the result must be true, not false

    -The verbose definition of the RegEx is:
    Match is the following regular expression (attempting the next alternative only if this one fails) "{\d* [EYF]}."
    Match the character "{" literally "{}".
    Match a single character present in the list "J" "[EYF]."
    Match a single digit 0. 9 paper"\d*»
    Between zero and unlimited times, as many times as possible, giving as needed (greedy) «*»
    Match the character "}" literally "}".
    Or match number 2 below (the entire match attempt fails if it cannot match) regular expression "{i}".
    Match the characters "{i}" literally "{i}".

    Typo unrecognized? Test the faulty method?

    Results are fake, as soon as I use the list of characters []] - but look at the first block of code: there are also lists of character they are treated properly.

    The braces in the regular expression must be escaped to be taken literally:

    var re_Def = /\{[EFJ]\d*\}/;
    

    Kind regards

    JoH

  • A special character validation using regular expressions in ADF

    Hi guys,.

    I want to put the validation of a special as character (,.') ((en) &, -) using regular expressions.

    I asked the posting as [a-zA-Z0-9'(.),--/ &] but it does not work properly.

    Special characters should be like:

    Comma,

    Hyfan-

    Dot.

    Open and close braces (and).

    Ampercent &

    Apastrophy '

    Space ""

    Please help if anyone has idea.

    And I also tried to put under expression as...

    [a-zA-Z] + (\\s* [0-9] * [a-zA-Z] *-* & * \\(*\\) *, *'*. *) * [a-zA-Z0-9] + but we need the validation if we put special characters between the charater as "ab," chain "& (bc).

    his does not work if I put a special character at the beginning and the end of the string in the ADF

    Thanks Timo...

    its working fine...

  • ADF Email of Validation using regular expressions

    Hello

    Wanted to add search Email Validation VO.

    It works 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 identification of email to be entered in capital letters.

    I tried with below the option does not work.
                   <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 over information of
    ADF Email of Validation using regular expressions
    The user enter email id without @.



    Please suggest this model to reach.


    Thank you
    JIT

    Published by: appsjit on January 25, 2013 19:08

    Hello.
    My English is not very good.

    I use below format and it works


    "^ [_A-Za-z0 - 9-] + (\.). [_A-Za-z0-9-]+)*@[A-Za-z0-9][A-Za-z0-9-]+ (-.)] ([A Za-z0-9] +) * (-.) [A-Za - z] {2,}) $»
    messageDetailNoMatch = "the value {1} is not a valid email address" / >

    Habib

    Published by: Habib Eslami on January 26, 2013 01:22

  • the simple regular expression problem

    Hello

    I need assistance with regular expressions. I have a situation when I need to get data from one table to the other and I think that my problem can be solved using REG EXP, but I don't know how to use them properly.


    I need to separate fileld varchar2 which is basically number/number in 2 separate number fields
     
    
    
    CREATE TABLE tst (CODE VARCHAR2(10)); 
    
    INSERT INTO tst VALUES('10/15'); 
    INSERT INTO tst VALUES('13/12'); 
    INSERT INTO tst VALUES('30'); 
    INSERT INTO tst VALUES('15'); 
    
    CREATE TABLE tst2 (po NUMBER, co NUMBER); 
    I need to get the code in the co and po columns. I think the result should look something like this, but:
     
    
    INSERT INTO tst2 
    SELECT regexp_substr(CODE 'something here to get the number before /') AS po, 
           regexpr_substr(CODE 'something here to get number after') AS co 
    FROM tst;   
    Any help appreciated

    Agree with the above,

    However, if you really want to know how to do with regular expressions you can do it like this...

    SQL> select regexp_substr('10/15','[^/]+',1,1) from dual;
    
    RE
    --
    10
    
    SQL> select regexp_substr('10/15','[^/]+',1,2) from dual;
    
    RE
    --
    15
    
  • VALIDATION OF EMAIL USING REGULAR EXPRESSIONS

    Hi all

    I'm new to regular expressions and trying to learn about them.
    As practice I am developing a query to filter identifying them invalid e-mail, for example: -.
      <some-name>.<some-name1>@gmail.com - VALID
      <some-name>_<some-name1>@gmail.com - VALID
      <some-name>@<some-name1>@gmail.com - INVALID 
    
     
    Let's say that the name column is EMAIL_ID
    So I have the expression to validate the end of the e-mail as follows
       select email from <table-name> where REGEXP_LIKE (EMAIL,'.com$')
    But I don't know (it is even possible to wheter) to filter the third mail electronic id
    provided that there * 2 @*.

    Any help in this regard would be welcome

    This is what you need

    select email from 
    where REGEXP_LIKE (EMAIL,'^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$')
    
    SQL> WITH t1 AS (SELECT '[email protected]' email FROM DUAL
      2              UNION
      3              SELECT '[email protected]' email FROM DUAL
      4              UNION
      5              SELECT 'test3@[email protected]' email FROM DUAL)
      6  SELECT email
      7    FROM t1
      8   WHERE REGEXP_LIKE (EMAIL,
      9                      '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$');
    
    EMAIL
    ---------------------
    [email protected]
    [email protected]
    
    SQL>
    
  • Regular expressions - problem

    Hi @ all,

    I need a regular expression more difficult, I don't know Don t.

    I have a big file with many pages .htm (800-1000) and I have to do the following:

    http://www.domain.de/ AB % 32-xyz? myshop = 123

    I have to delete the "ab % 32-xyz", the problem is, that it is, it could be each symbol, the letter or digit.

    Then the area between " " http://www.domain.de/ ' 'and'? myshop = 123 "(these 2 areas are identical in all documents each time) should be removed.

    Anyone could tell me how to do this with regular expressions in dreamweaver?

    Thank you

    Felix

    P.S.: Sorry, my English is not so good, I m from the Germany

    You want to replace the random text with anything?

    If this is not the case, this is how you do in DW:

    1. Make a backup of the folder that you want to change, just in case something goes wrong
    2. Edition > search and replace
    3. In the find and Replace dialog box, select the folder in the menu drop-down "search in" and select the folder that you want to use.
    4. Select the Source Code from the drop-down search menu.
    5. Place the following code in the search text box:
      (http://www \.domain\.de/) [^?] +(\? MYshop = 123)
    6. Place the following code in the text box replace:
      $1$ 2
    7. In Options, select the checkbox "use regular expression.
    8. Click on replace all. Dreamweaver warns you that the operation cannot be undone in pages that are not currently open. As long as you have made a backup, click OK to run the operation.
  • Chain problem: not being able to escape a bracket for a possible regular expression

    So, I have barely any idea of how to use regular expressions except a little knowledge of it in PHP.

    What I'm trying to do is to separate the first part of a string of qualifier, so I need a regular expression since ideally I wish I could. The problem I have is that my attempt of separation does not work. I tried to do what I think the model or class Matcher, I tried to use String.split, and I tried using the regular String.replace method. What I'm trying to do is illustrated (I hope) in the following NBS:
    public class SSCCE
    {
        public static void main(final String args[])
        {
            final String testString = "I want to keep this sentence. (I wish to "+
                "discard this sentence and the space in between the sentences.)";
            final String testExtract = testString.replace(" \(.+\)","");
            System.out.println(testExtract);
        }
    }
    From my understanding, the parentheses are supposed to be a wild card of sorts, so they would need to be escaped in order to be taken as a literal, which means that line 7 is supposed to correspond to any of the characters inside the brackets where the opening is preceded by a space and then delete them. The problem I have is that escaping brackets generates an error and does not escape their product the original string. So I don't know how to tell Java I use actually literal parentheses.

    I tried to configure my preferences of error to ignore everything, but it does not work.

    I don't know if it's important, but I use Java 1.6 and Eclipse for PHP 1.3.2.20110218 - 0812.

    rp0428 wrote:
    Shouldn't be using replaceAll if you use a regular expression?

    http://docs.Oracle.com/javase/6/docs/API/Java/lang/string.html

    and, on the assumption that you actually use a replaceAll(), you need to escape to the '-' characters as they are themselves i.e. Java escape characters

    " \\(.+\\)"
    

    In addition, the use of ".". +"can lead lead to important feedback. In this simple example you probably won't notice it, but in general, you'd better avoid the return back by using the reluctant modifier or by replacing the '.' by a character set that does not include the character terminal.

  • Problem with regular Expression

    Hello!!
    I have a problem with the regular expression. I want to validate only one word, and second are the same. To do this, I wrote a regex

    Model p=Pattern.compile("([a-z][a-zA-Z]*)\\s\1");
    Matcher m = p.matcher ("nikhil nikhil");
    Boolean t = m.matches ();
    If (t)
    System.out.println ("it's a game");
    on the other
    System.out.println ("is no match);

    The result I get is always 'there no match. "

    Your timely help will be very appreciated.

    Concerning

    Hello.

    You are missing a slash in the regex

    Pattern p = Pattern.compile("([a-z][a-zA-Z]*)\\s\\1");
    Matcher m = p.matcher("nikhil nikhil");
    boolean t = m.matches();
    if (t) {
        System.out.println("There is a match");
    } else {
        System.out.println("There is no match");
    }
    

Maybe you are looking for

  • E-mail put block filter in place correctly, but does not work

    Following the instructions of 'Block sender' I've set up this filter. I can add e-mail addresses in the filter, but when I click "Run now" nothing happens. I created this filter in a different e-mail account and it works properly. Why it won't work i

  • 70 - Lenovo B50 i3 4030U Windows 10 Pro - BIOS update

    Hello! I have BIOS version v3.02 installed, but I see a new v3.04 version available here http://support.Lenovo.com/us/en/products/laptops-and-netbooks/Lenovo-b-series-laptops/LENOVO-B50-70-... This new version of BIOS update v3.04 is available for my

  • Program accelerates when you move the mouse

    I use a simple few stripcharts program and have put a clock on the screen to measure the milliseconds per program cycle.  I noticed that when I move the mouse, it takes about 33mS to perform the loop, but when I move the mouse, it goes down to 8mS.  

  • I have a problem with the installation of internet explorer 8

    I tried to open the IE 8 installation and he said this thing: The Setup program could not verify the integrity of files needed for the installation. Make sure the cryptographic service is running on this computer. I checked the cryptographic service

  • Win 7 Pro to win 10 updated

    I waited for the Update icon and it does not.  I have all the necessary updates installed and SP1.  I looked at a variety of sites about and ran to the compatibility check and everything seems fine. What Miss me? Win 7 had for years and no problems,