Regular expression check in form

Hi All,
I am trying to plugin Regular expression check on the user form, for different fields. Can I do it in a java file and call this java class file in the validation part? if yes how can i do it if no what are the other alternatives?
Thanks in advance

I did the following using Xpress and a regular expression "if (/\D/.test(Val))" in JavaScript to check for non-numeric characters in a field.
          <Field name=':variables.approvalSAPID'>
            <Display class='Text'>
              <Property name='title' value='SAP ID of Approving Manager'/>
              <Property name='required'>
                <Boolean>true</Boolean>
              </Property>
              <Property name='maxLength' value='8'/>
              <Property name='size' value='8'/>
              <Property name='help' value='SAP ID of the person who is being asked to approve request'/>
            </Display>
            <Validation>
              <cond>
                <and>
                  <eq>
                    <length>
                      <ref>:variables.approvalSAPID</ref>
                    </length>
                    <i>8</i>
                  </eq>
                  <script>
                      var Val = env.get(':variables.approvalSAPID');
                      testMe(Val);
                      function testMe (Val) {
                                             if (/\D/.test(Val))
                                                return (false);
                                             else
                                                return (true);
                    </script>
                </and>
                <null/>
                <s>! The SAP ID of the Approving Manager must be an 8 digit number !</s>
              </cond>
            </Validation>
          </Field>
Larry L. Viars
Sr. Systems Programmer
Enterprise Systems Management
CenterPoint Energy LLC.

Similar Messages

  • Regular expression checker

    hi,
    i am new to regular expression. i would like to know if there is a tool to check regular expressions? the tool should based on the entered regular expression display the result.
    thanks

    import java.util.regex.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class JavaRegxTest extends JFrame implements ActionListener{
      JTextField regxInput, textInput;
      JButton doMatchButton, resetButton, exitButton;
      JTextArea resultsArea;
      public JavaRegxTest(){
        super("JavaRegxTest");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        Container cp = getContentPane();
        cp.setLayout(new GridLayout(2, 1));
        JPanel upPanel = new JPanel(new GridLayout(5, 1));
        upPanel.add(new JLabel("regular expression:   "));
        upPanel.add(regxInput = new JTextField(50));
        upPanel.add(new JLabel("sample text:          "));
        upPanel.add(textInput = new JTextField(50));
        JPanel buttonPanel = new JPanel(new GridLayout(1, 3));
        buttonPanel.add(resetButton = new JButton("RESET"));
        buttonPanel.add(doMatchButton = new JButton("MATCH"));
        buttonPanel.add(exitButton = new JButton("EXIT"));
        upPanel.add(buttonPanel);
        resetButton.addActionListener(this);
        doMatchButton.addActionListener(this);
        exitButton.addActionListener(this);
        resultsArea = new JTextArea(20, 60);
        resultsArea.setEditable(false);
        JScrollPane jsp = new JScrollPane(resultsArea);
        cp.add(upPanel);
        cp.add(jsp);
        setSize(550, 700);
        setVisible(true);
      public void actionPerformed(ActionEvent e){
        JButton btn = (JButton)(e.getSource());
        if (btn == exitButton){
          System.exit(0);
        else if (btn == resetButton){
          reset();
        else if (btn == doMatchButton){
          doMatch();
      /* clear text */
      void reset(){
        regxInput.setText("");
        textInput.setText("");
        resultsArea.setText("");
      /* display match results */
      void doMatch(){
        resultsArea.setText(resultsArea.getText() + "REGX=" + regxInput.getText()
         + "\n" + "TEXT=" + textInput.getText() + "\n");
        try{
          Pattern pat = Pattern.compile(regxInput.getText());
          String sampleText = textInput.getText();
          Matcher mat = pat.matcher(sampleText);
          int gc = mat.groupCount();
          for (int i = 0; i <= gc; ++i){ //for each capture group
            resultsArea.setText(resultsArea.getText()
             + "GROUP" + i + " : \n"); //GROUP0 == whole match
            while (mat.find()){ //display every matched parts
              resultsArea.setText(resultsArea.getText()
               + " " + mat.group(i) + "\n");
            mat.reset(sampleText); //go to next group
        catch(Exception e){
          resultsArea.setText(e.toString());
      public static void main(String[] args){
        JavaRegxTest jrt = new JavaRegxTest();
    }

  • Regular expression: check for the presence of special characters.

    I have the following requirement:
    I need to check for the presence of the following characters in a keyword: @, #, > if any of these characters are present, then they need to be stripped off, before going further. Please let me know the regular expression to check for these characters.

    I am trying to extend the same logic for the following characters:
    .,‘“?!@#%^&*()-~<>[]{}\+=`©® . here is the code fragment:
    Pattern kValidator = Pattern.compile("[\\.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]");
    Matcher kMatcher = kValidator.matcher(keyWord);
    if (kMatcher.find(0)) {
    keyWord = keyWord.replaceAll("[.,\\‘\\“?!@#%^&*()-~<>[]{}\\+=\\`©®]", " ");
    }I get the following error. This error is from the weblogic command window. I dont understand these special characters.
    Error:
    28 Oct 2008 12:27:48 | INFO  | SearchController   | Exception while fetching search results in controller:Unclosed character class near index
    39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
    java.util.regex.PatternSyntaxException: Unclosed character class near index 39
    [\.,\&#915;Çÿ\&#915;Ç£?!@#%^&*()-~<>[]{}\+=\`&#9516;&#8976;&#9516;«]
                                           ^
            at java.util.regex.Pattern.error(Pattern.java:1650)
            at java.util.regex.Pattern.clazz(Pattern.java:2199)
            at java.util.regex.Pattern.sequence(Pattern.java:1727)
            at java.util.regex.Pattern.expr(Pattern.java:1687)
            at java.util.regex.Pattern.compile(Pattern.java:1397)
            at java.util.regex.Pattern.<init>(Pattern.java:1124)
            at java.util.regex.Pattern.compile(Pattern.java:817)

  • Regular Expression Search in Forms Builder

    Hi everyone, can anyone help me out?
    I'm working on a legacy forms migration project (3 to 10g) where item references often do not include the block name.
    eg.
    :stock_level := :default_level;
    instead of
    :stk.stock_level := :ctrl.default_level;
    There are also instances of set_item_property('stock_level',....)
    In complex multi-block forms this obviously makes the form difficult to understand.
    Is there a way in which I can search the triggers and program units of a form for items that don't have a block prefix? The Forms search and replace function has a Regular Expression feature, but I have no experience in this area.
    I assume I'm looking for something like this:- ":", followed by a character string that doesn't contain a "." or "="
    Thanks

    You might have a look at the commercial product formsAPIMaster, it has the ability to do such searches (and also automatic replacements, if needed)

  • Regular expression check

    Hi,
    I want to check if a certain VARCHAR2 field contains a string that conforms to a certain regular expression: "[a-zA-Z0-9_\-]+" (in other words the string may only contain the characters a-z case insensitive and/or numbers 0-9 and/or an underscore and/or a dash. Is this possible with an Oracle 9i database and/or can this be done without using regular expressions?
    Regards,
    Peter

    Have a look at the TRANSLATE function
    Example;
    select 'TRUE' from DUAL
    where'a-zA-Z0-9_\-'  =
                          TRANSLATE('a-zA-Z0-9_\-',
                                                  '01234567890_-abcdefghijklmnopqrstuvwxyzABCDFEGHIJKLMNOPQRSTUVWXYZ',
                                                  '01234567890_-abcdefghijklmnopqrstuvwxyzABCDFEGHIJKLMNOPQRSTUVWXYZ') ;
    'TRU
    TRUE
    Here I add an  *
    select 'TRUE' from dual
    where 'a-*zA-Z0-9_\-*' =
                        TRANSLATE('a-zA-Z0-9_\-',
                                                 '01234567890_-abcdefghijklmnopqrstuvwxyzABCDFEGHIJKLMNOPQRSTUVWXYZ',
                                                 '01234567890_-abcdefghijklmnopqrstuvwxyzABCDFEGHIJKLMNOPQRSTUVWXYZ');
    no rows selected
    Hi,
    I want to check if a certain VARCHAR2 field contains a string that conforms to a certain regular expression:"[a-zA-Z0-9_\-]+" (in other words the string may only contain the characters a-z case insensitive
    and/or numbers 0-9 and/or an underscore and/or a dash.
    Is this possible with an Oracle 9i database and/or can this be done without using regular expressions?
    Regards,
    Peter

  • Regular expression on form value

    I have a form value that I need to add a regular expression to the end so I can pick up any characters after the form value.
    Example if someone enters Jones then I want to make sure the value could also search Jones Jr or Jones Sr.
    Basically add a space and any characters a-z to the form value.
    Here is my attempt but lost on regular expression part:
    REReplace ("form.myvalue","[[:space:]]","Not sure what the regular expression would be here?","ALL")

    This will replace "Jones Jr" and "Jones Sr" in the following text:
    "this is a test text Jones Jr and Jones Sr"
    ReReplaceNoCase("your_text_in_which_you_want_to_replace",
    "#form.myvalue#[[:space:]][a-z]*", "replacement_text", "ALL")
    Mack

  • How to set keepalive check for regular expression

    Hi
    We are using css110501 CSS.
    Right now the keepalives on services are set using hash values.
    But i want to change this keepalives to implement keepalives with regular expression checking.
    Any Ideas?

    The CSS supports it's own native scripting language that can be used to write keepalives among other things.
    Here is an example of a script that I wrote to check a page for some specific text:
    ! Filename: ap-kal-statpage
    ! Parameters: None - must be coded in script
    ! Description:
    ! This script will attempt to connect to a host and
    ! "GET" an html page. The script checks the contents
    ! of the page for a particular string. If the string
    ! is found, the script passes.
    ! Failure Upon:
    ! 1. The correct arguments are not supplied.
    ! 2. The CSS is unable to connect to the host.
    ! 3. The string is not found in the page.
    no echo
    if ${ARGS}[#] "LT" "4"
    echo "Usage: ap-kal-portlist \'Hostname Port Page String ...\'"
    exit script 1
    endbranch
    set host "${ARGS}[1]"
    set port "${ARGS}[2]"
    set page "${ARGS}[3]"
    set string "${ARGS}[4]"
    set EXIT_MSG "Host ${host} not responding on TCP port ${port}."
    socket connect host ${host} port ${port} tcp
    socket send ${SOCKET} "GET ${page} HTTP/1.0\n\n"
    set EXIT_MSG "String was not found."
    socket waitfor ${SOCKET} "${string}" 200
    socket disconnect ${SOCKET}
    echo "String ${string} was found."
    no set EXIT_MSG
    exit script 0

  • Regular Expression Character Occurance.

    Hello,
    I have a name textfield and I want certain characters like "-" to occur one time only.
    i.e. The textfield can accept "Jean Luc" or "Jean-Luc" (french name), but not "Jean--Luc" or "Jean------------Luc" right.
    The regular expression  /\-?/ looks correct but it does not seem to work.
    We use "\" because "-" is an escape character and the character "?" to make "-" occur 0  or 1 time only.

    I am making sure that the textfield accept only text like "Jean-Luc" and not "-----Jean--Luc".
    My regular expression is already very long so I will add 5 or more additional parameters in the if statement which will not be a problem.
    Below is a very common regular expression which looks simple but it will not accept "[email protected]" and non western characters.
    /^[a-zA-Z0-9._-]+@[a-zA-z0-9.-]+\.[a-zA-z]{2,4}$/
    Email regular expressions are complicated. The range of permissible email adresses and some domain sometimes include non western characters which is quite rare but certainly does exist. I guess there is no precise regular expression for user forms.
    Checking user input becomes more complicated if some bored to death folks have a habit of playing drums on keyboard which result to "asdf;lkjasdf;lkjasdf;lkajsdf;lkajsdf;lkajsdf;lkj".

  • Uri regular expression matching

    Hi, for some reason I cannot get a uri to match the following regular expression check.
    <If $uri !~ '^/dir/\?somename=(.*)'>
    NameTrans fn="restart" uri="/shownomatch?uriwas=$uri"
    </If>
    <Else>
    NameTrans fn="restart" uri="/showamatch?value=$1"
    </Else>I can see in the page that is restarted to that it should match by printing out the uriwas parameter.
    An example uri that should match but doesn't is /dir/?somename=5f801297-a8f6-42a4-933d-660f2120cd0d
    Any thoughts? I've tried a few different valid regular expressions, but cannot get a match.

    Thank you all for the help.
    My main goal was to provide verification that a user has logged in and has the proper authority to access a directory/resource. What I believe I now have is a check to verify that the user has a required cookie and that the value in the cookie matches the parameter in $query.
    Below is what I now have in the server's obj.conf file. Let me know if you think there is something that I am missing.
    <If $uri =~ '^/ValidationApp/*'>
      <Client security="false">
        NameTrans fn="redirect" url-prefix="https://server.domain.edu"
      </Client>
    </If>
    <If $uri !~ '^/ValidationApp/*'>
      <Client security="true">
        NameTrans fn="redirect" url-prefix="http://server.domain.edu"
      </Client>
    </If>
    <If $uri =~ "/SomeDir/*">
      <If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/SomeDir'))"}>
        NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/SomeDir'))"
      </If>
    </If>
    <If $uri =~ "/AnotherDir/*">
      <If not defined $query or not defined $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"} or $query !~ 'uuid=(.*)' or $& ^ $cookie{"$(lookup('cookiemap.conf','/AnotherDir'))"}>
        NameTrans fn="restart" uri="/ValidationApp/CookieCheckServlet?loc=$uri&uid=$(uuid())&ReqInfo=$(lookup('cookiemap.conf','/AnotherDir'))"
      </If>
    </If>The servlet used in the restart checks to see if the required cookie exists (ReqInfo) and if the uuid value (uid) is set in the session. If so it forwards to the uri (loc). If not it forwards to a login form the checks the user ID/password. It adds the uid to the session, creates the cookie, and forwards back to the requested uri.
    The Client security checks are down to make sure the user uses HTTPS when entering their user ID/Password.

  • Regular Expressions - Problem

    Hi @ all,
    I need a complicate regular expression, I don´t know.
    I have a big folder with many .htm pages (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 in this are, there could be every symbol, letter or number.
    So the area between "http://www.domain.de/" and "?myshop=123" (these 2 areas are everytime identical in all documents) shoud be deleted.
    Could everyone say me, how to do this with regular expressions in dreamweaver?
    Thanks,
    Felix
    P.S.: Sorry, my Engish is not so good, I´m from Germany

    Do you want to replace the random text with anything?
    If not, this is how you do it in DW:
    Make a backup of the folder you want to edit, just in case anything goes wrong
    Edit > Find and Replace
    In the Find and Replace dialog box, select Folder from the "Find in" drop-down menu, and select the folder you want to work with.
    Select Source Code from the Search drop-down menu.
    Put the following code in the Find text area:
    (http://www\.domain\.de/)[^?]+(\?myshop=123)
    Put the following code in the Replace text area:
    $1$2
    In Options, select the "Use regular expression" check box.
    Click Replace All. Dreamweaver will warn you that the operation cannot be undone in pages that aren't currently open. As long as you have made a backup, click OK to perform the operation.

  • Checking a number sequence with regular expressions

    Hello,
    Suppose I have a text in the pattern:
    A1=ha,A2=bla,A3=cha,...
    I don't know how many sections of "A#=$" (# denotes number, $ denotes text) will be in the text, but I want to verify that the numbers of the A's form the natural ascending number sequence (i.e 1,2,3,...). I prefer to use regular expressions to do this, but if there's another way, I will be glad to hear it too.
    Therefore my question is: How can I use regular expressions to check for a sequence of numbers? I know I can search for groups I've caught previously in the expression, but how can I compute the next number in the sequence from the group and search for the result?
    Thank you very much!

    What I'd do--and I'm not saying this is optimal, just what pops immediately to mind--is have a regex that matches "A(\\d+)=" (assuming the ha, bla, cha can never be "A1" etc.--if they can, you can still do it, but it's more complicated), then you iterate with the Matcher, and each time, you get the Integer.valueOf what you matched. You keep track of the last value, and compare the current to the last. If current is < last (or <= last, depending on your requirements), fail.
    Something like this. I don't recall Matcher's methods off the top of my head, so you'll have to fix the details.
    Matcher m = Pattern.matcher("A(\\d+)=");
    int maxSoFar = Integer.MIN_VALUE;
    while (m.matches(input)) {
        int current = Integer.parseInt(m.getMatchedField("$1"));
        if (current <= maxSoFar) {
            // fail
        else {
            maxSoFar = current;
    } maxSoFar =

  • Regular expression not working for adobe forms

    Hi,
    Iam using qtp for adobe forms and for some reason if i put in regular expression for apid value it doesn't recognise the object..there is nothing wrong with the regular expression as it is evaluated using regular expression evaluator in qtp 11.0....any ideas
    I got all the addins and everything and when i used regular expression for the top window it works but for any other object it doesn't

    Please try the code and see the problem. The regular expression is fine.
    I can replace the string with these and got results like this:
    import java.util.regex.Pattern;
    public class HtmlFilter implements TextFilter {
        private static String strTagPattern = "<\\s?(.|\n)*?\\s?>";
        private static int patternMode = Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.CANON_EQ;
        private static Pattern tagPattern = Pattern.compile(strTagPattern, patternMode);
        public String filter(String t) {
              if(t==null || t.length()==0) return "";
            String ret = null;
            return tagPattern.matcher(t).replaceAll("");
         public static void main(String[] args) {
              System.out.println(new HtmlFilter().filter(null));
              System.out.println(new HtmlFilter().filter(""));
              System.out.println(new HtmlFilter().filter("<P>abc def</P>"));
              System.out.println(new HtmlFilter().filter("<P>&#25105;&#22269;&#30707;&#27833;&#20379;&#24212;&#23433;&#20840;&#31995;&#32479;&#24433;&#21709;</P>"));
    }The results are
    abc def
    ????????????

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

  • Regular Expressions for textfield syntax checking while typing?

    Hi all,
    my application has a textfield for entering customer numbers. The customer numbers have a certain syntax which I want to have checked while the user types.
    According to our company's style guide, the textfield's background color has to be
    - RED in case of an error,
    - WHITE in case of correct input,
    - YELLOW when the input is incomplete but the beginning is correct.
    To check the syntax with Regular Expressions is easy for the WHITE and RED cases. But I'm struggling with the YELLOW case.
    public static boolean checkTest(String s) {
         String regExp = "(\\d{6,8},\\d{1,3},\\d{1,3},\\d{1,2})";
         return Pattern.matches(regExp, s);
    }The above method returns true for the following examples:
    "12345678,1,2,3"
    "123456,11,22,33"
    "1234567,123,123,12"
    I now need another method which returns true if the user entered a valid beginning, for example:
    "123"
    "1234567,"
    "123456,123,1"
    Any ideas? I would be glad to get this done...

    @notivago
    In the meantime I also came up with a pattern to
    check the YELLOW case:
    String partly =
    "\\d{0,8},?|\\d{6,8},\\d{0,3},?|\\d{6,8},\\d{1,3},\\d{
    0,3},?|\\d{6,8},\\d{1,3},\\d{1,3},\\d{0,2}";Sounds good to me.
    It seems to work. But my actual goal is to do such
    color-coded syntax checking for other number types
    (other patterns) as well. And it should be easy to
    add or change number types.I cant figure how to do that for now.
    So it would be nice to have a generic way to generate
    the YELLOW-pattern from the other one. Is it
    possible? Probably, but I cannot come up with any idea now.
    Is there a better solution than my one
    ("String partly" above)? Something I can just append
    to the original pattern for example?There are others, but it is hard to say what would be better or worse.

  • Checking valid e-mail's using Regular expressions

    Hey buddies ,
    I desperately need some help here. I need to develop a generic method that wiull use regular expressions and patterns to validate an e-mail.
    Does anyonw have any idea on how to do this. And if possible please share some code with me.
    Thanks a lot

    You can do regular expresions in java using java.util.regex.*:
    import java.util.regex.*;
       Pattern p = Pattern.compile("\\S++\\s++");
       Matcher m = p.matcher(sInputLine);
       if(m.find()){
          sUser = m.group().trim();
       }For more info on regular expressions in java, check out the javadocs:
    http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html

Maybe you are looking for

  • Sine, Square & Sawtooth sweep generation with variable duty cycle/rise time & fall time

    Dear All ! I request and need some candid advices on the subject issue keeping in view the following notes: 1) I am a novice in LabView. 2) I was an average Electronics Engineering graduate who graduated about 9 years ago and since then I have not be

  • Wacom Intuos 3 pen not working in Lightroom 4

    I have the latest Wacom Intuos 3 driver for my system, Windows 7 Pro 64-bit, and it works fine in Photoshop CS6, but doesn't work at all in Lightroom 4.  My Wacom mouse works, but not all that well either in Lightroom 4. I would appreciate any help t

  • Bpm 64 bit or 32bit

    Friends Just wanted to check if there is a bpm 64 bit enterprise version and 32 bit one separate or is there is universal installer which can be used for both 64 and 32 bit? Thanks

  • CCM 2.0 with ECC 6.0

    Hi Guys, We are trying to integrate CCM 2.0 with ECC 6.0 on the purchasing application of ECC. The requirement suggests that the requester should be able to access the catalogue via OCI from ME51n (Create a PR) and select a good/service and add it to

  • HT201272 how do i download previous purchase on my mac computer

    How do i downloan previous purchase to my imac desktop computer