Regular expressing in javascript

Hi All,
Does anybody know if there's a way to find out how many words
appear in a string using regular expression in javascript? For
example, I have the following code that pops a "Not OK" alert
whenever str contains "it it it information technology", and I need
to find out how many times the word "it" exists in the string using
regular expression.
<html>
<body>
<script type="text/javascript">
var str = "it it it information technology";
var reg = /^(\bin\b|\bit\b|\bof\b)(?!
(\bin\b|\bit\b|\bof\b))/;
reg = new RegExp(reg);
var result = str.match(reg);
document.write(result);
if (result) {
alert("OK");
} else {
alert("Not OK");
</script>
</body>
</html>
Thanks very much in advance!

Refer
this
tutorial.

Similar Messages

  • Regular expressions in JavaScript for CP5?

    I'm having trouble implementing a regular expression from within the JavaScript window. First of all, does CP 5 support regular expressions?

    On slide 1 I have a Text Entry Box, (called TheTeb) with a Submit button. TheTeb has variable associated with it called TypedText.
    In the box, the user may type anything.
    On slide 2 there is a caption.
    The caption must show the text that the user typed  into TheTeb but filtered so that only the letters, numbers, and spaces can be shown.
    For example,
    if the user types:           123 & abc /DEF
    the caption will show: 123 abc DEF
    This requirement is represents the behavior of an application that I am simulating, so I don't want to change the interaction in any way.
    My strategy is to use 2 different variables, one for the text entry box (TypedText), the other for the caption (FilteredText). I can add JavaScript to the On Enter event of slide 2. The script will Get the TypedText, pass the TypedText to FilteredText, and run a regular expression somewhere so the filtered text displays on slide 2.
    Here's the script so far:
    var objCP = document.Captivate;    
    var ScriptTypedText = objCP.cpEIGetValue('TypedText');
    function ReturnValue(){    
      objCP.cpEISetValue('FilteredText', ScriptTypedText);
    ReturnValue();
    The script works as is. The user types text on slide 1 (as TypedText), presses Enter and the text shows up on slide 2 (as $$FilteredText$$). Obviously, the trouble is, I don't know where to add my regular expression into the JavaScript so the text actually gets filtered. Do I make a new function?
    By the way, a sort of pseudocode syntax for the expression would be:
    FilteredText = TypedText.replace(/ /g,"");

  • Regular expressions in ActionScript??

    I have been looking at the Adobe publication Programming Action Script (pdf) and it
    specifies ECMA-262 3rd edition specification. But the specification don't seem to
    state exactly what type of regular expression engine and version is used.
    Is it POSIX, or PERL compatible regular expressions (or both)?
    I have read and used the classic O'Reilly text Mastering Regular Expressions
    and coded regular expressions in javascript/php/etc (anywhere regular expressions
    could be use, Apache configuration file, other server config files, etc etc etc)
    There is a difference in the type of engine used, where as performance is
    concerned, as well as the range of syntax valid in a particular implementation.
    Thank You
    JK

    http://www.regular-expressions.info/javascript.html

  • Validate form entries: does java support regular expressions?

    i want to validate form entries, does java support regular express like javascript?

    Just recently in 1.4 regex was finally introduced :)
    Take a look at http://developer.java.sun.com/developer/technicalArticles/releases/1.4regex/

  • Does Safari support the lazy operator in a JavaScript regular expression?

    I've already filed a bug for this. Anyway I'd like to know if you already knew it.
    If you go to http://noteslog.com/personal/projects/regexp/test.html you'll see an input box and a "Go!" button. Put a JavaScript regular expression in the box and click the button. Shortly you'll see a red line showing how many characters have been matched.
    If you try
    \[\w\W\]
    you get a correct result (all matched)
    but if you try
    <\?\[\w\W\]*?\?>
    you get a wrong result (nothing matched) and the issue is due to the fact that the ? after the * is not treated as a laziness operator.
    Test in IE, FF, and Opera too, and you'll see that they work as expected.
    Message was edited by: Andrea Ercolino

    If you try it from http://regexpal.com/ you'll see that it works as it should in IE and FF but not in Safari.
    Message was edited by: Andrea Ercolino

  • Javascript problem / regular expressions.

    I've got what should be a simple thing to do for regular expressions... but I'm not able to get it to work.. can someone point me to where I left my brain.
    inputField.name is being ouputed correctly if I use an alert.
    I want to step into the if statement if the inputField.name contains "DTL FUND ID" anywhere in the name. I've tried several things for the regexp and can't seem to get it to work. Can someone please educate me on this... I've used them before and have been able to check to make sure the name would follow a certain pattern (numbers of letters..) but not sure about matching an exact string...
    as far as I know I can't use a .contains method or anything like that in javascript.
    function percentAmountFunction(inputField){
        deNameReqExp = new RegExp();      
         if(deNameReqExp.exec(inputField.name) != null){               
              alert("inside function");
    }

    ahhh thanks for the info...
    you are correct about the name... the name is equal to something like iefft831101... that was the description... I had not added the code to pull the description out yet so I was just using the name for test purposes but had not changed to text that would go in the regexp yet.

  • Javascript regular expression issue

    Hi,
    I am trying to use a javascript regular expression in my code
    var reg_exp = new RegExp("^([0-9]{2})/([0-9]{2})/([0-9]{4})\s([0-9]{2})$");it works from outside of APEX but not being called from inside APEX. It is failing on the
    \sIs there some override or some reason why I cannot do this from inside APEX?
    Thanks in advance!

    Well I just changed it to
      var reg_exp = new RegExp("^([0-9]{2})/([0-9]{2})/([0-9]{4}) ([0-9]{2}):([0-9]{2})$");basically just replaced an actual space for \s and it works fine...

  • Help with Regular Expression for field validation

    I'm fairly new to using regular expressions and using Acrobat. This is probably a simple question, but I've been unable to figure it out.
    I have a text field on a PDF that I would like to be 9 characters in length. The first 2 characters can only be alphanumeric, the last 7 characters can only be numeric.
    At first I was using the following, which allows all the characters to be alphanumeric:
    var re = /^[A-Za-z0-9 :\\_]$/;
    if (event.change.length >0) {
    if (event.willCommit == false) {
        if (!re.test(event.change)) {
            event.rc = false
    That works fine, but it's not quite what I needed. With some assistance I changed it (see below) to fit what I was looking for. However, this didn't work; it prevents anything from being entered in the field:
    var re = /^[A-Za-z0-9]{2}\d{7}$/;
    if (event.change.length >0) {
    if (event.willCommit == false) {
        if (!re.test(event.change)) {
            event.rc = false
    Any help would be greatly appreciated.
    Thanks...

    Here's a function you can call form the field's custom Format script. It should be placed in a document-level JavaScript:
    function custom_ks1() {
        // Define non-commited regular expression
        var re = /^[A-Za-z0-9]{0,2}([0-9]{0,7})?$/;
        // Get all of the characters the user has entered
        var value = AFMergeChange(event);
        // Allow field to be cleared
        if(!value) return;
        if (event.willCommit) {
            // Define commited regular expression
            var re = /^[A-Za-z0-9]{2}[0-9]{7}$/;
            if (!re.test(value)) {  // If final value doesn't match, alert user
                app.alert("Your error message goes here.");
                // event.rc = false
        } else {  // not commited
            // Only allow characters that match the regular expression
            event.rc = re.test(value);
    Call it like this:
    // Custom Keystroke script
    custom1_ks();

  • Inline display of error message for a regular expression validation

    Hi All,
    I am using ApexLib in my application.
    I am using regular expression validation for some of the items.
    Those validation will happen when the button is pressed and the message will be displayed as per the error.
    But, I want the errors to be displayed immediately when the focus is away from that item.
    as we do for required items.
    could anybody help me to achieve it?
    Thanks in advance
    bye
    Srikavi

    Hi Srikavi,
    to achieve a Validation of an item when leaving the field you'll have to use some javascript code (as ApexLib does internally).
    What do you need:
    - onChange - Event on your Item
    - some Javascript code which is called in the onChange Event (you can put this code either in your page html header or, if it is used more often in your application, in a seperate js File)
    - call the ApexLib method apexlib.error.showError to display your error
    I actually never tried it myself, but i'm pretty sure that this will work (according to what i've seen in the ApexLib code).
    Have fun and tell us how it went,
    Peter
    Edited by: peter_raganitsch on Sep 5, 2008 11:56 AM

  • Regular expressions in Format Definition add-on

    Hello experts,
    I have a question about regular expressions. I am a newbie in regular expressions and I could use some help on this one. I tried some 6 hours, but I can't get solve it myself.
    Summary of my problem:
    In SAP Business One (patch level 42) it is possible to use bank statement processing. A file (full of regular expressions) is to be selected, so it can match certain criteria to the bank statement file. The bank statement file consists of a certain pattern (look at the attached code snippet).
    :61:071222D208,00N026
    :86:P  12345678BELASTINGDIENST       F8R03782497                $GH
    $0000009                         BETALINGSKENM. 123456789123456
    0 1234567891234560                                            
    :61:071225C758,70N078
    :86:0116664495 REGULA B.V. HELPMESTRAAT 243 B 5371 AM HARDCITY HARD
    CITY 48772-54314                                                  
    :61:071225C425,05N078
    :86:0329883585 J. MANSSHOT PATTRIOTISLAND 38 1996 PT HELMEN BIJBETA
    LING VOOR RELOOP RMP1 SET ORDERNR* 69866 / SPOEDIG LEVEREN    
    :61:071225C850,00N078
    :86:0105327212 POSE TELEFOONSTRAAT 43 6448 SL S-ROTTERDAM MIJN OR
    DERNR. 53846 REF. MAIL 21-02
    - I am in search of the right type of regular expression that is used by the Format Definition add-on (javascript, .NET, perl, JAVA, python, etc.)
    Besides that I need the regular expressions below, so the Format Definition will match the right lines from my bankfile.
    - a regular expression that selects lines starting with :61: and line :86: including next lines (if available), so in fact it has to select everything from :86: till :61: again.
    - a regular expression that selects the bank account number (position 5-14) from lines starting with :86:
    - a regular expression that selects all other info from lines starting with :86: (and following if any), so all positions that follow after the bank account number
    I am looking forward to the right solutions, I can give more info if you need any.

    Hello Hendri,
    Q1:I am in search of the right type of regular expression that is used by the Format Definition add-on (javascript, .NET, perl, JAVA, pythonetc.)
    Answer: Format Definition uses .Net regular expression.
    You may refer the following examples. If necessary, I can send you a guide about how to use regular expression in Format Defnition. Thanks.
    Example 6
    Description:
    To match a field with an optional field in front. For example, u201C:61:0711211121C216,08N051NONREFu201D or u201C:61:071121C216,08N051NONREFu201D, which comprises of a record identification u201C:61:u201D, a date in the form of YYMMDD, anther optional date MMDD, one or two characters to signify the direction of money flow, a numeric amount value and some other information. The target to be matched is the numeric amount value.
    Regular expression:
    (?<=:61:\d(\d)?[a-zA-Z]{1,2})((\d(,\d*)?)|(,\d))
    Text:
    :61:0711211121C216,08N051NONREF
    Matches:
    1
    Tips:
    1.     All the fields in front of the target field are described in the look behind assertion embraced by (?<= and ). Especially, the optional field is embraced by parentheses and then a u201C?u201D  (question mark). The sub expression for amount is copied from example 1. You can compose your own regular expression for such cases in the form of (?<=REGEX_FOR_FIELDS_IN_FRONT)(REGEX_FOR_TARGET_FIELD), in which REGEX_FOR_FIELDS_IN_FRONT and REGEX_FOR_TARGET_FIELD are respectively the regular expression for the fields in front and the target field. Keep the parentheses therein.
    Example 7
    Description:
    Find all numbers in the free text description, which are possibly document identifications, e.g. for invoices
    Regular expression:
    (?<=\b)(?<!\.)\d+(?=\b)(?!\.)
    Text:
    :86:GIRO  6890316
    ENERGETICA NATURA BENELU
    AFRIKAWEG 14
    HULST
    3187-A1176
    TRANSACTIEDATUM* 03-07-2007
    Matches:
    6
    Tips:
    1.     The regular expression given finds all digits between word boundaries except those with a prior dot or following dot; u201C.u201D (dot) is escaped as \.
    2.     It may find out some inaccurate matches, like the date in text. If you want to exclude u201C-u201D (hyphen) as prior or following character, resemble the case for u201C.u201D (dot), the regular expression becomes (?<=\b)(?<!\.)(?<!-)\d+(?=\b)(?!\.)(?!-). The matches will be:
    :86:GIRO  6890316
    ENERGETICA NATURA BENELU
    AFRIKAWEG 14
    HULST
    3187-A1176
    TRANSACTIEDATUM* 03-07-2007
    You may lose some real values like u201C3187u201D before the u201C-u201D.
    Example 8
    Description:
    Find BP account number in 9 digits with a prior u201CPu201D or u201C0u201D in the first position of free text description
    Regular expression:
    (?<=^(P|0))\d
    Text:
    0000006681 FORTIS ASR BETALINGSCENTRUM BV
    Matches:
    1
    Tips:
    1.     Use positive look behind assertion (?<=PRIOR_KEYWORD) to express the prior keyword.
    2.     u201C^u201D stands for that match starts from the beginning of the text. If the text includes the record identification, you may include it also in the look behind assertion. For example,
    :86:0000006681 FORTIS ASR BETALINGSCENTRUM BV
    The regular expression becomes
    (?<=:86:(P|0))\d
    Example 9
    Description:
    Following example 8, to find the possible BP name after BP account number, which is composed of letter, dot or space.
    Regular expression:
    (?<=^(P|0)\d)[a-zA-Z. ]*
    Text:
    0000006681 FORTIS ASR BETALINGSCENTRUM BV
    Matches:
    1
    Tips:
    1.     In this case, put BP account number regular expression into the look behind assertion.
    Example 10
    Description:
    Find the possible document identifications in a sub-record of :86: record. Sub-record is like u201C?00u201D, u201C?10u201D etc.  A possible document identification sub-record is made up of the following parts:
    u2022     keyword u201CREu201D, u201CRGu201D, u201CRu201D, u201CINVu201D, u201CNRu201D, u201CNOu201D, u201CRECHNu201D or u201CRECHNUNGu201D, and
    u2022     an optional group made up of following:
         a separator of either a dot, hyphen or slash, and
         an optional space, and
         an optional string starting with keyword u201CNRu201D or u201CNOu201D followed by a separator of either a dot, hyphen or slash, and
         an optional space
    u2022     and finally document identification in digits
    Regular expression:
    (?<=\?\d(RE|RG|R|INV|NR|NO|RECHN|RECHNUNG)((\.|-|/)\s?((NR|NO)(\.|-|/))?\s?)?)\d+
    Kind Regards
    -Yatsea

  • Need help in unix regular expressions

    Hi All,
    I'm new to shell scripting. Please help me in achieving this
    I am trying to a find regular expression that need to pick a file with begin with the below format and mask variable is called in xml file.
    currently the script accepts:
    mask="CLIENT_ID+'_ADHSUITE_IN_'+date2str(now,'MMddyy','US/Eastern')+'.txt'"
    But it should accept in the below format
    2595_ADHSUITE_IN_ANNWEL_030309_2009-02-10_15-12-46-000_648.TXT715.outpgp_out
    where CLIENT_ID=2595. How to place wild card character '*' in the below to accept file in the above format. here is what i made changes.
    mask="CLIENT_ID+'_ADHSUITE_IN_'*+date2str(now,'MMddyy','US/Eastern')*+'.TXT'*+'.outpgp_out'"
    Please help.
    Thanks

    I believe your statement is being passed over twice:
    First Pass: (This is done by something like javascript)
    CLIENT_ID+'_ADHSUITE_IN_'+'.*'+date2str(now,'MMddyy','US/Eastern')+'.*'+'.TXT'+'.*'+'.outpgp_out'In this pass the variables and functions that are enclosed in literals are processed:
    (1) CLIENT_ID is replaced by 2595 or whatever is current value is:
    (2) date2str(now,'MMddyy','US/Eastern') gets replaced by 040609 (if the current time now is 4th april 2009).
    So at the end of this first pass we have a string:
    2595_ADHSUITE_IN_.\*040609.\*.TXT.*.outpgp_outThis string at the end of the first pass is a Posix basic regular expression. (ref: [http://en.wikipedia.org/wiki/Regular_expression] ) accessed at time of post).
    This is the string I put in the Regular Expression text box on [http://www.fileformat.info/tool/regex.htm]
    and it matches "2595_ADHSUITE_IN_ANNWEL_040609_2009-01-27_17-02-28-000_631.TXT715.outpgp_out" for me (though I prefer my egrep test).
    I hope this is somewhat clearer. Remember I have very little information about your system/application and I make big guesses.
    NB: (I should thank Frits earlier for pointing my sloppiness between wildcards (for eg unix shell filename expansion) and regular expressions).
    For the second pass this used to compared other strings to see

  • Regular Expressions in ABAP

    Hi, all!
    Are there any possibilities to make use of regular expressions in 4.6C (FMs, classes)?
    Regards,
    Maxim.

    Hi Maxim and all others whoever may read this ,
    try the following code - but be patient and leave my (c) where it is:::
    You may also have a look at the specialities of JavaScipt RegEx.
    Yours,
    Johannes
    * an Example Call:
    DATA return_value TYPE string.
    DATA: match type ztmatch,
    lastindex TYPE i,
    leftcontext TYPE string,
    rightcontext TYPE string,
    index TYPE i,
    searchstring TYPE string,
    modifier TYPE string,
    regex TYPE string,
    found TYPE boolean,
           error_message type string.
    regex = 'b+(a)*(b+)'.
    searchstring = 'abbbbabbaa'.
    modifier = ''.
    CALL METHOD ztr_bw_tools=>regex
      IMPORTING
        LASTINDEX     = lastindex
        LEFTCONTEXT   = leftcontext
        RIGHTCONTEXT  = rightcontext
        INDEX         = index
        FOUND         = found
        MATCH         = match
        RETURN_VALUE  = return_value
        ERROR_MESSAGE = error_message
      CHANGING
        SEARCHSTRING  = searchstring
        MODIFIER      = modifier
        REGEX         = regex
    Changing SEARCHSTRING TYPE STRING  DEFAULT '' "string to be regex applicated
    Changing MODIFIER TYPE STRING  DEFAULT '' "/gims/
    Changing REGEX TYPE STRING  DEFAULT '' "regular expression
    Exporting LASTINDEX TYPE I
    Exporting LEFTCONTEXT TYPE STRING
    Exporting RIGHTCONTEXT TYPE STRING
    Exporting INDEX TYPE I
    Exporting FOUND TYPE BOOLEAN "boolean variable (X=true, -=false, space=unknown)
    Exporting MATCH TYPE ZTMATCH "For use with regular expressions
    Exporting RETURN_VALUE TYPE STRING
    Exporting ERROR_MESSAGE TYPE STRING
    method REGEX .
    * (c) by Johannes Rumpf - 2006 -
    * Matching-Table of part matches of brackets
    *DATA: BEGIN OF ztmatch,
    *        comp TYPE string,
    *      END OF ztmatch.
    DATA source TYPE string.
    DATA js_processor TYPE REF TO cl_java_script.
    js_processor = cl_java_script=>create( ).
    * JavaScript --> ABAP variablen Mapping
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'regex'
                         CHANGING data      = regex ).
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'searchstring'
                         CHANGING data      = searchstring ).
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'modifier'
                         CHANGING data      = modifier ).
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'index'
                        CHANGING  data      = index ).
    js_processor->bind( EXPORTING name_obj  = 'abap'
                                  name_prop = 'match'
                        CHANGING  data      = match ).
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'lastindex'
                        CHANGING  data      = lastindex ).
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'leftcontext'
                        CHANGING  data      = leftcontext ).
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'rightcontext'
                        CHANGING  data      = rightcontext ).
    js_processor->bind( EXPORTING name_obj  = ' '
                                  name_prop = 'found'
                         CHANGING data      = found ).
    * eine Leerzeile hinzufügen
    DATA: wa like line of match.
    wa-comp = ' '.
    append wa to match.
    * JavaScript Code *REGEX*
    CONCATENATE
    'var re = new RegExp(regex, modifier);'
    'var m = re.exec(searchstring);'
    '  if (m == null) {'
    '    found = false;'
    '  } else {'
    '  found = true; '
    '    index = m.index;'
    '    lastindex = m.lastIndex;'
    '    leftcontext = m.leftContext;'
    '    rightcontext = m.righContext;   '
    '    var len = abap.match.length;'
    '    for (i = 0; i < m.length; i++) {'
    '      abap.match[len-1].comp = m<i>;'
    '      abap.match.appendLine();'
    '      len++;'
    INTO source SEPARATED BY cl_abap_char_utilities=>cr_lf.
    return_value = js_processor->evaluate( source ).
    error_message = js_processor->LAST_ERROR_MESSAGE.
    endmethod.

  • Using regular expressions for validating time fields

    Similar to my problem with converting a big chunk of validation into smaller chunks of functions I am trying to use Regular Expressions to handle the validation of many, many time fields in a flexible working time sheet.
    I have a set of FormCalc scripts to calculate the various values for days, hours and the gain/loss of hours over a four week period. For these scripts to work the time format must be in HH:MM.
    Accessibility guidelines nix any use of message box pop ups so I wanted to get around this by having a hidden/visible field with warning text but can't get it to work.
    So far I have:
    var r = new RegExp(); // Create a new Regular Expression Object
    r.compile ("^[00-99]:\\] + [00-59]");
    var result = r.test(this.rawValue);
    if (result == true){
    true;
    form1.flow.page.parent.part2.part2body.errorMessage.presence = "visible";
    else (result == false){
    false;
    form1.flow.page.parent.part2.part2body.errorMessage.presence = "hidden";
    Any help would be appreciated!

    Date and time fields are tricky because you have to consider the formattedValue versus the rawValue. If I am going to use regular expressions to do validation I find it easier to make them text fields and ignore the time patterns (formattedValue). Something like this works (as far as my very brief testing goes) for 24 hour time where time format is HH:MM.
    // form1.page1.subform1.time_::exit - (JavaScript, client)
    var error = false;
    form1.page1.subform1.errorMsg.rawValue = "";
    if (!(this.isNull)) {
      var time_ = this.rawValue;
      if (time_.length != 5) {
        error = true;
      else {
        var regExp = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
        if (!(regExp.test(time_))) {
          error = true;
    if (error == true) {
      form1.page1.subform1.errorMsg.rawValue = "The time must be in the format HH:MM where HH is 00-23 and MM is 00-59.";
      form1.page1.subform1.errorMsg.presence = "visible";
    Steve

  • How to make a regular expression case insensitive?

    Hi,
    I am using SAP UI5 .
    I am validating the user input using a regular expression to make sure user dose not enter a keyword which is reserved.
    var regexAppID = /^(?=^(?:(?!(^Admin$|^AdminData$|^Push$|^smp_cloud$|^resource$|^test-resources$|^resources$|^Scheduler$|^odata$|^applications$|^Connections$|^public|^Public$|[\.]{2,}|^[\.])).)*$)(?=^[a-zA-Z]+[a-zA-Z0-9_\.]*$).*$/;
    textField.mBindingInfos.value.type.oConstraints.search = regexAppID;
    The regex blocks the user from entering the keywords Admin,AdminData etc.
    It works fine if the user enters the value as it is given in regex (ie case sensitive example "Admin").
    But when user enters "admin" or "aDmin" etc the regex is not catching it and my server crashes as it bypasses these keywords.

    Can't you use this expression?
    ^/(?!ignoreme$)(?!ignoreme2$)[a-z0-9]+$
    Then you will have only a match when the word is something else then "ignoreme" or "ignorme2".
    Why don't you just check it in an IF statement? if(input==="ignoreme" or ... ) ? It's both static.. or you could put all options in an array and use the statement indexOf to find if it is in the array.
    JavaScript Array indexOf() Method
    Kind regards,
    Wouter

  • Difference between regular expressions and spry character masking?

    Hi,
    This is my first time writing my own regular expressions.  Often times though, they seem to work in various testing widgets, but then they do not perform as expected in Spry.  I have no idea how to even begin to debug this.
    For example, this string:
    ^\#?[A-Fa-f0-9]{3}([A-Fa-f0-9]{3})?$
    Does a perfect job enforcing hex colors in a regexp testing widget.  But it doesn't work in spry.  It won't let me type a darn thing in.
    Can somebody throw me a bone here?

    Hi!
    Thank you for the response.  I read that article prior to posting and it seems to relate more to Spry's custom pattern function rather than regular expressions.  Here's the code I have:
    <script type="text/javascript">
         <!--     
              var text_1 =
              new Spry.Widget.ValidationTextField(
                   "text_1",
                   "none",
                   {regExpFilter:/^#[A-Fa-f0-9]{6,};$/,
                   useCharacterMasking:true,
                   validateOn:["change"]})
         //-->
    </script>
    Expected behavior:  I should be able to type in a valid hex color and have Spry perform validation.
    Actual behavior:  I can't type anything in, at all.  I immediately get the invalid Spry feedback (in my case a little red .png image and an error message).
    Simpler expressions like this work fine in Spry:
                        <script type="text/javascript">
         <!--
              var text_1 =
                   new Spry.Widget.ValidationTextField(
                   "text_1",
                   "none",
                   {regExpFilter:/[a-z]/,
                   useCharacterMasking:true,
                   validateOn:["change"]})
         //-->
    </script>
    I think if I can figure out what the special rules are for one somewhat robust regular expression in Spry, then I will be off and running.
    Can anyone help?
    Scott

Maybe you are looking for

  • How do I get a pdf to open using Safari?

    How do I get a pdf to open using safari?

  • Processed status of RFQ/PR to PO

    hI, How to know the status of RFQ? Whether it has been processed in to PO? I know there is a way thru ME4N, but i tried that and not able to do the same. Regards, Satyendra 9920137977

  • Navigator Password

    Hello, I am trying to use the Oracle Navigator to create my publications and subscriptions. In the documentation for Oracle Lite V4.0.0.2 it says to log in as CONSOLIDATOR/MANAGER. This username and password does not work for me. Does anybody know of

  • Why do I get an error when I try to apply a theme?

    For some strange reason, the theme that I created, does not want to apply to some of my projects.  I'm working on a work project, and updated my theme as I went along.  It was all fine, until I changed the Object Styles, and suddenly, out of the 7 pr

  • I lost my internet for four days and now my extreme will not do anything

    After losing my internet connection for four days when it returned my airport extreme will not do anything. I tried resets and still nothing?