AFExactMatch and regular Expressions

Hello

I'm working on something similar to this http://forums.adobe.com/message/4215772#4215772.

My first shot at it.  Found it useful messages of try67 and George.  I'm almost there and now, I'm stumped.

My Custom Format Script is the following:

Custom Format script for the text field

If (event.value) event.value += '% ';

My typing a custom Script is the following:

Custom keystroke script

DigOnlyKS();

My custom calculation script is the following:

If (event.value == "") event.value = 0;

My Javascript Document is:

function DigOnlyKS() {}

Get everything that is currently in the field

var val = AFMergeChange (event);

Refuse entry if other thing that the figures

Event.RC = AFExactMatch (/ \d* /, val);

Event.RC = AFExactMatch (/^100\.0| [1-9] {1,2}\.\d{1}|0\.\d{1}$/, val);

}

Valid entries must be: 100.0, 1.0 to 99.9, and 0.1 to 0.9.

The regular Expression seems to work on the Regex testers online.

However, I can't enter anything in the field with the foregoing.

If replace my Regex with the link above - ^ \d+\. ? \d{0,2}$ - I can enter data in the field.

However, if I remove the? the - ^\d+\.\d{0,2}$ - regex to require (I think) the decimal places, I can't enter anything in the field.

Clearly, Miss something.

Thank you.

Regular expression is not appropriate for a typo script until the value has been committed, and even in this case, it may be too restrictive (for example, does not allow for ".") 9 »).

The way I would be inclined to implement would be to put the strike and Validate Format (not calculate) scripts to call the following functions, respectively.

// Custom Keystroke script calls this
function percent_ks() {

    AFNumber_Keystroke(1, 1, 0, 0, "", false);

}

// Custom Format script call this
function percent_fmt() {

    AFNumber_Format(1, 1, 0, 0, "", false);
    if (event.value) event.value += "%";

}

// Custom Validate script calls this
function percent_val() {

    if (event.value === "") event.value = 0;

    // Only allow numbers from 0 to 100
    if (+event.value >= 0 && +event.value <= 100) {
        // round to nearest tenth
        event.value = util.printf("%.1f", event.value);
    } else {
        event.rc = false;
        app.alert("Your error message goes here.", 3);
    }

}

It lets you enter values outside the valid range, but the validation script takes care of it. It also allows more than one digit to the right of the decimal, but the validation script it rounds up to the tenth closest. Make sense?

Edit: correction of fault

Tags: Acrobat

Similar Questions

  • regular expressions in ActionScript?

    I've been watching the Adobe programming Action Script (pdf) publication and it

    Specifies the ECMA-262 3rd edition specification. But the specification do not seem

    specify exactly what type of version and the regular expression engine is used.

    Is - this POSIX or PERL compatible regular expressions (or both)?

    I have read and used the classic O'Reilly Mastering Regular Expressions text

    and regular expressions encoded in javascript/php/etc. (regular expressions anywhere

    can be used, Apache configuration file, other server configuration files, etc. etc. etc.)

    There is a difference in the type of engine used, while the performance is

    concerned, as well as the range of syntax is valid to a particular implementation.

    Thank you

    JK

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

  • "Matches regular Expression" and "Model match" vi behaves differently

    Hello

    I need a simple matching chain and experimenting that found the "Regular Expression Match' and 'Correspondence model' vi behave a little differently. I guess that the entries of the regular expression on the two the same behavior. It's a difference that I discovered that the "|" character ("vertical" character, commonly used as an operator 'or') is recognized as such in the regex to Match vi, but not in the match vi model (where it is taken to the letter). Furthermore, I can't find any document using (online or in LabVIEW) on the ' | ' usage in regular expressions of character. Is - this documented anywhere?

    For example, suppose I want corresponding to one of the following 4 words: 'The' or 'fast' or 'brown' or 'fox '. The regular expression ' the | fast | Brown | Fox' (without the quotes) works for the vi Regular Expression Match but not the match pattern vi. Here is a photo of the block diagram and the results of the façade:

     

    The Help explains that the vi Regular Expression Match performs a little more slowly the match vi pattern, so I started with the latter. But since he does not work for me, I'll use the old. But does anyone have an idea of the speed difference? I guess that's negligible in a simple example.

    Thank you!

    Thank you, Jeff. That's what I was looking for. BUT my version of LabVIEW 8.5, does NOT say "functionfor example, the Match model does not support the parenthesis or vertical bars (|) characters.«» !

    See: http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_pattern/

    and http://zone.ni.com/reference/en-XX/help/371361D-01/glang/match_regular_expression/

    It is not mentioned in the help of special characters used for the match pattern : http://zone.ni.com/reference/en-XX/help/371361D-01/lvhowto/specialcharformatchpatt/

    The only place | has 'talked', it is in the sentence: "some regular expressions that use alternating (such as (. |))". \s)*) require significant resources to deal with when it is applied to the large input strings. "But I'm not processing a large chain.

    It seems that NEITHER fixed this omission. What version is your help?

    Ed

  • Looking for a good tesxtbook / and or Web site that explains regular expressions

    I need a manual, for about 70 euros or less, which includes an explanation of regular expressions. I picked up a few things from the text of Steve O'Hearn ora 1z0-047 and ora-docs and articles online, but I want to expand a little bit.

    Also if anyone know a good site that may have a little thorough but easy to read (think intermediate user even though I'm not sure I consider myself even that) promenade walk through regular expressions, please see it me.

    Thank you very much.

    Hello

    If you insist on the books, then:

    https://www.safaribooksonline.com/library/view/Oracle-regular-expressions/0596006012/

    http://www.ktipsntricks.com/data/eBooks/Oracle/Oracle%20regular%20expressions.PDF

    Greetings,

    SIM

  • How can I the date and time using regular expressions

    Hi all

    I have depolyed filtering the log agent. While setting properties, I would like to recover the file that is generated at the present time, but along the way, I am unable to define, what regular expression that I provide retireves date and time specific file...

    Leave with kindness, men know is it possible to do?

    Thanks in advance.

    Shiva

    This seems to be the same question I can't add a timestamp in logfilter, so I'll answer in this thread. Please check the two wires as "Answered" when the issue has been resolved.

    Kind regards

    Brian Wheeldon

  • Validation of regular expression delimiter alphanumeric and hose

    I have a header in the file as below

    EMP_ID | EMP_NAME | DEPARTMENT | SALARY | ACTIVE1

    past to a string

    String test = ' EMP_ID | EMP_NAME | DEPARTMENT | SALARY | ACTIVE1;

    I need to check if the header is only of alphanumeric characters and pipedelimiter is allowed.

    other than these, I need to trigger an error.

    Any suggestions.

    had the regular expression pattern

    It's the string pattern = "^ ([a-zA-Z0-9 |]) '. +)$";

  • The Regular Expressions and GUID.

    Hello gurus, I hope you can help me!
    I need to select GUID from a table and to do this, I need the regular Expression. My
    Perl is not good and not good Regular Expression. My database is Oralce 11.2.0.2.0 and
    Linux (Oracle Version 6) is the operating system of the Machine. If you need further information,
    I'll look closely. Thank you. Jehangir.

    >

    Hi Jehangir and welcome to the forums.

    I need to select the GUID of a table and to do this,

    Well, the first thing we do is read the forum FAQ and also the post by BluShadow
    at the top of the messages on the home page of the forum. You should have provided code (DDL
    and DML) showing your particular problem, but since it's your first time, I'll be gentle ;)

    We have it done - clients have sometimes GUID as PKs, and we need to send data to
    their systems, but it is not as simple as it may first appear.

    GUID may arise in three formats.

    The Oracle one - SELECT Sys_GUID() from DUAL which is just a string of 32 hexadecimal characters.
    Then the chain with the hyphen, then the string with dashes and {} at the beginning and end (see
    examples of data).

    with datax as
    (
      SELECT '79A864CCD8E44CD8B0A2765DF9EF337B' as guid  FROM DUAL  UNION ALL
      SELECT '79A864CFD8E44CD7B0A2765DF9EF337B' FROM DUAL UNION ALL
      SELECT '8gdfsgsgfdg' FROM DUAL UNION ALL  -- dummy for testing
      SELECT '21EC2020-3AEA-1069-A2DD-08002B30309D' FROM DUAL UNION ALL
      SELECT '21EC5550-3AEA-1069-A2FF-08002B30309D' FROM DUAL UNION All
      SELECT '{21CC2020-3AFA-1A69-A2DD-08002B30309D}' FROM DUAL
    )
    
    -- first one is the Oracle format
    select * from datax where regexp_like(guid, '[0-9a-fA-F]{32}'); -- Oracle select sys_guid();
    
    -- second one is with hyphens
    
    select * from datax where regexp_like(guid, '[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}');
    
    -- third one is with hyphens and curly brackets.
    
    select * from datax where regexp_like(guid, '^\{[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}\}$');
    
    -- This converts both of the last two formats back into Oracle format, which is what
    -- we use. Notice, that I haven't used regualar expressions to do this. Regexes are
    -- computationally expensive, and you should use Oracle's string furnctions if possible
    
    SELECT REPLACE(REPLACE(REPLACE(GUID, '{', ''), '}', ''), '-', '')  FROM Datax;
    

    HTH,

    Paul...

    Jehangir.

  • Help with the Regular Expressions and regexp_replace

    Oh great guru Oracle can I can receive assistance

    I need to clean the phone numbers that have been entered in the table per_phones of Oracle e-Business. Some of the phone numbers have hyphens, some have spaces and some have tank. I just want to get out all the figures and then re - format the number.

    E.g.
    914-123-1234... out (914) 123-1234
    9141231234... new (914) 123-1234
    914 123 1234... (914) 123-1234
    MyPhone... just null
    (914)-123-1234... (914) 123-1234

    I really tried to understand the instructions of regular expressions, but for some reason, I can't understand it.

    For example:

    SQL> with sample_data as (
      2   select '914-123-1234' phone_number from dual union all
      3   select '9141231234'                from dual union all
      4   select '914 123 1234'              from dual union all
      5   select '(914)-123-1234'            from dual
      6  )
      7  select regexp_replace(
      8           regexp_replace(phone_number, '\D')
      9         , '(...)(...)(....)'
     10         , '(\1) \2-\3'
     11         ) as formatted_num
     12  from sample_data
     13  ;
    
    FORMATTED_NUM
    --------------------------------------------------------------------------------
    (914) 123-1234
    (914) 123-1234
    (914) 123-1234
    (914) 123-1234
     
    
  • Grouping and backreferences with regular expressions on the window to replace the text

    I'm really appreciate the inclusion of regular Expressions in the search and replace functionality. One thing miss me that East of backreferences in the replacement expression. For example, in unix tools vi or sed, I could do something like this:
     s/\(firstPart\) \(secondPart\) \(oldThirdPart\)/\2 \1 newThirdPart/g 
    that allow me to switch the places of first and secondPart and substitute totally thirdPart. If grouping and backreferences are already present in the window replace text, how do you properly call them?

    Published by: Justin.Warwick on August 23, 2011 08:26

    You can vote on the request for this to the exchange of SQL Developer, to add weight to the implementation as soon as possible: https://apex.oracle.com/pls/apex/f?p=43135:7:3693861354483465:NO:RP, 7:P7_ID:16761

    Kind regards
    K.

  • Find and replace - regular expression to help?

    How can I find ' <!-* PAGE footer AREA *-> "and replace it and evething after with my new coding of footer on all my pages.

    The problem is:

    The code in my existing page footer area is not the same on all pages.

    I want to replace it with a new one on all pages

    I watch the operators of regular expressions, not found patern that works...

    Thanks in advence for your help

    The following regular expression is the and everything up, but not including the closing tag:

    [\s\S]+(?=<\/body>)
    

    Use it in the search field and put the comment and the code to the footer in the field replace. Select use regular expression.

    Always make a backup before using a regular expression on many pages.

  • Regular expression find and replace with wildcards

    Hello!

    For the world of me, I can't understand the right way to do it.

    I made a list of family names, first names. I want to have a different style than the first name, last name.

    So that's what I have now:

    < b > AAGAARD, TODD, s. < /b > < br >
    AAMOT, KARI, < b > < /b > < br >
    < b > AARON, MARJORIE, c. < /b > < br >

    and that's what I have:

    < span class = "Name" > AAGAARD </span > < span class = "FirstName" >, TODD, s. </span > < br / >

    < span class = "Name" > AAMOT </span > < span class = "FirstName" >, KARI, </span > < br / >

    < span class = "Name" > AARON </span > < span class = "FirstName" >, MARJORIE, C. </span > < br / >

    Any ideas?

    Thank you!

    Make a backup first.

    In the use of the search box:

    (\w+),\s+([^<]+)<\/b>\s*

    In the field using replace:

    $1 $2

    Select use regular expression. Light blue paper touch, then click on replace all.

  • regular expression: letters and numbers allowed

    How can I determine the best next way: input string can only contain numbers and letters, the letters can be of any alphabet.
    Examples:
    "123aBc" - correct, only numbers and letters
    "' aBc 123 '-bad, contains spaces
    "' aBc 123 '-bad, contains commas
    "oauo" - correct, contains letters of the Estonian alphabet.
    "abc" - correct, contains letters of the English alphabet.

    I think that I should use the function "regexp_like' for this, because-LIKE operator cannot do such things, correct?

    How should I write the regular expression then? I'm new on reg expressions.

    Hello

    I don't think that you need one or. A simple replacement would do.

    with Test as
        (select '123aBc' Str from dual union
         select '123,aBc' from dual union
         select 'aäüõ' from dual
         )
        --
        select str
        from test
       where regexp_like(replace(str,'.',''), '^[[:alnum:]]*$')
    

    Arun-

  • RESOLVED: Understand regular expressions in search and replace - use it to replace everything between two comments

    I solved this by using the following regular expression in find DW and replace dialogue, it will be all the html on several lines between two specified comments:

    <!-NameofStartingComment--(.| \s)*?--NameofEndingComment-->)




    Hello

    I have structured my site in dreamweaver with each page between the comments section:

    <! - navBarStart - >
    HTML here
    <! - naveBarEnd - >

    I used this method because I wanted to be able to easily use the find and replace dialogue with regular expressions to update pieces of code throughout my site. However, I have real problems finding the correct regular expression to use.

    So in every page I have my <! - startHtmlSection - > <!-endHtmlSection-> between these two tags, I sometimes have different HTML. I want to find the regular expression I could use 'generic' of all the html to a find a replacement between two of my comments specified. Can anyone help? I googled and tried everything what is obvious (after you have selected the regular expressions in the find and Replace dialog) but DW never find the tags in the pages of sites.

    I solved this by using the following regular expression in find DW and replace dialogue, it will be all the html on several lines between two specified comments:

    Hello

    I have structured my site in dreamweaver with each page between the comments section:


    HTML here

    I used this method because I wanted to be able to easily use the find and replace dialogue with regular expressions to update pieces of code throughout my site. However, I have real problems finding the correct regular expression to use.

    So in every page I have my between these two tags, I sometimes have different HTML. I want to find the regular expression I could use 'generic' of all the html to a find a replacement between two of my comments specified. Can anyone help? I googled and tried everything what is obvious (after you have selected the regular expressions in the find and Replace dialog) but DW never find the tags in the pages of sites.

  • Regular Expression search and replace question - please help!

    I was wondering if someone could help me I have a lot of paper with notes like this: [1], but I need them to look like in this [1].

    I don't know what to put in the section find [[\d]*] , but I need help with what to put in the field replace to make < sup > numbers]

    In fact, your regular expression is false. What you need is the following:

    (\[\d+\])

    The field replace must contain this:

    $1

  • Number of shaped with preg_replace Regular Expression and PHP

    Hello

    I would like to add a 'dash' after every 3 digits in a given number (10 digits). For example, 9785678941 became 978-567-894-1. How could I achieve this with regular expression using PHP preg_replace?

    Thank you.

    The next solution is based on the example of "The use of backreferences followed literals digital" published on the php.net site.

    In accordance with the $string, $pattern, $replacement nomenclature which is the php.net example use, here´s my modification:

    <>

    $string = '9785678941';

    $pattern = ' / (\\d{3})(\\d{3})(\\d{3})(\\d{1)} /';

    $replacement = ' ${1}-{2}-${3}-${4}';

    echo preg_replace ($pattern, $replacement, $string);

    ?>

Maybe you are looking for

  • ERROR: Out of MEMORY, help, please

    Edition of Windows: Windows 7 Home Premium Processor: Intel Core i7 860 RAM: 8 GB System type: 64-bit operating system Motherboard: Asus P7P55D motherboard Graphics card: GeForce GTX 295 Manufacturer: myself Error: Out of memory error when I enter on

  • How to play videos on Windows Media Player 11 MPs

    I have several video files of format of MPs who will not play on my desktop Windows Media Player.   How can I solve this.

  • Failure ID: 94UC1V-52C6P5-XD0021-60XM03

    A test start because labtop has failed. startup takes for seeral hours and all I want to do is very long. Most things don't work at all. She passed the test of memory and INTELLIGENT control. Short DST failed and the failure ID is: 94UC1V-52C6P5-XD00

  • Is "Voipesec" a new term?

    Hi Experts, I came across a term "voipesec." Is that a valid warrant or recognized in network? I'd appreciate all solutions...

  • Security level limited access to high security

    Dear all, I have something that I need your help it clarify for me; for reasons of tests outside NAT in PIX, I placed a host on the external interface of my FW PIX and another on the inside interface. We'll call inside host (Host: 172.16.1.178) and o