Validation on text item as Regular Expression Question(Repetition Operator)

These are my success entries for a field;
123456,
123456,123456,
123456,123456,123456,
123456,123456,123456,123456,
"," seperated 6 digits can be repeated unlimited times.
I found on documentation this; "Repetition Operators; {m,}     Match at least m times" and for my need i tried this regular expression; "^[[[:digit:]]{6},]{1,}$", but didnt worked :(
Any comments?
Thank you very much :)
Tonguc

Your expression is a little incorrect because you can't use repetition operators within a bracket expression. How about something like this
"^([[:digit:]]{6},)+$"
Regards,
Peter

Similar Messages

  • Regular Expression Question, Repetition Operators

    These are my success entries for a field;
    123456,
    123456,123456,
    123456,123456,123456,
    123456,123456,123456,123456,
    "," seperated 6 digits can be repeated unlimited times.
    I found on documentation this; "Repetition Operators; {m,}     Match at least m times" and for my need i tried this regular expression; "^[[[:digit:]]{6},]{1,}$", but didnt worked :(
    Any comments?
    Thank you very much :)
    Tonguc

    repeating exactly 6
    {6}
    repeating at least 1
    +
    repeating at least 6
    {6,}
    ok, your problem is [ instead of (                                                                                                                                                                                                                                                    

  • Validation on text item

    Hi all,
    i have a text item P6_MAXLIABILITY
    I put a validation on that item with regular expression.
    I want that validation to happen, when the focus moves to the next item.
    could any one give me a suggestion?
    bye
    Srikavi

    Hi,
    if the focus changes the javascript is event "onblur();" automatically fired. Then you can call own javascript function and validate the input.
    Example:
    <form name="test" action="">
    Name: <input type="text" name="input1" onblur="checkContent(this.value)">
    </form>
    <script type="text/javascript">
    document.test.input1.focus();
    function checkContent (field) {
    if (field == "") {
    alert("Please input something!");
    document.test.input1.focus();
    return false;
    </script>

  • Reset Item After Regular Expression Validation Fails

    Apex 4.2
    I have a page item (P1_MYITEM) that should only hold alpha charaters, so I have created an item regular expression validation
    using
    ^[a-zA-Z]+$
    This works well, but now I want to reset my item (P1_MYITEM) to null
    if the validation fails.
    Tried using a page process, but they do not run if the validation fails.
    Any ideas ?
    Gus

    Got it working using
    Begin
      if not regexp_like (:P1_MYITEM, '^[a-zA-Z]+$')
        then
          APEX_UTIL.SET_SESSION_STATE('P1_MYITEM',NULL);
          return 'Country must be text characters only.';
      end if;
    End;

  • Regular Expressions - Questions to SME

    Ralph Benzinger presented an online meetup on the topic of Regular Expressions.  The presentation (slides only) can be found <a href="http://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/866072ca-0b01-0010-54b1-9c02a45ba8aa">here</a>
    Unfortunately the recording is not going to be available, but Ralph has been generous enough to agree to answer questions posted to this sticky thread.
    cheers,
    Marilyn

    Hello Peter,
    You're welcome!
    Alas, I was unable to locate the regex documentation on help.sap.com either.  In fact, I'm not even sure it has already been updated for 2004s.  I recommend that you use the online documentation within the system, e.g., from transactions SE38 or SE80.  Do an index search for "regex", and you'll be directed to REGEX, FIND and REGEX, REPLACE, both of which have extensive subsections on regexes.
    The class cx_sy_regex is an exception class that is thrown by FIND, REPLACE and cl_abap_regex in case of an invalid regex, such as ".\1" (there is no capture group that back reference \1 can refer to).  If the pattern is known statically, the syntax check will report this error, but for statements like "FIND REGEX pat IN text.", the actual pattern is only known at runtime.
    The cx_sy_matcher class (and its subclasses) similarly indicate some invalid states, for example trying to call "cl_abap_matcher->replace_found( )" when the matcher has no current match to replace (e.g., replace_found( ) called twice in a row).
    Please let me know if I can provide some additional information.
    Regards
    Ralph

  • Regular Expression question I think

    My application is receiving HTML as a string and I'm trying to simplify it before displaying. The string could contain one or more substrings similar to this:
    <span style="cursor:pointer" onmouseout="hideTooltip()" onmouseover="createTooltip( this,'The quartile that your firm\'s value falls into.  Each quartile contains 25% of the values in the Peer Group. The 1st Quartile is always the best.  The 4th Quartile is always the worst.', ( findPosX( this ) - 150))">Quartile</span>The text will not be consistent and it may be in the string as many as 4 times. What I'd like to do is replaceAll so that I end up with
    <span>Quartile</span>Is there a way to do this with regular expression? I've tried replaceAll("<span .*>","<span>") But that takes out everything to the end of the String. I want it to stop at >.
    Any way?

    replaceAll("<span .*?>","<span>")

  • Regular expression question (should be an easy one...)

    i'm using java to build a parser. im getting an expression, which i split on a white-space.
    how can i build a regular-expression that will enable me to split only on unquoted space? example:
    for the expression:
    (X=33 AND Y=44) OR (Z="hello world" AND T=2)
    I will get the following values split:
    (X=33
    AND
    Y=34)
    OR
    (Z="hello world"
    AND
    T=2)
    and not:
    (Z="
    hello
    world"
    thank you very much!

    Instead of splitting on whitespace to get a list of tokens, use Matcher.find() to match the tokens themselves: import java.util.*;
    import java.util.regex.*;
    public class Test
      public static void main(String[] args) throws Exception
        String str = "(X=33 AND Y=44) OR (Z=\"hello world\" AND T=2)";
        List<String> tokens = new ArrayList<String>();
        Matcher m = Pattern.compile("[^\\s\"]+(?:\".*?\")?").matcher(str);
        while (m.find())
          tokens.add(m.group());
        System.out.println(tokens);
    }{code} The regex I used is based on the assumptions that there will be at most one run of quoted text per token, that it will always appear in the right hand side of an expression, and that the closing quote will always mark the end of the token.  If the rules are more complicated (as sabre150 suggested), a more complicated regex will be needed.  You might be better off doing the parsing the old-fashioned way, with out regexes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Regular Expressions Question

    I am using regular expressions to parse through a text file generated by a set of sensors attached to a SeaBird CTD profiler, what matter is that some lines use quotes as a special marker and some dont, but I need to treat both as the same data. Here is the example:
    SeaBird Datafile (just some part):
    "# name 0 = depS: depth, salt water [m]"
    "# name 1 = t068: temperature, IPTS-68 [deg C]"
    # name 2 = sal00: salinity, PSS-78 [PSU]
    "# name 3 = sigma-t00: density, sigma-t [kg/m^3]"
    "# name 4 = flS: fluorometer, sea tech"And I am using this regular expression to read this lines and save those names:
    private static final String ColumnName = "(^\"#|^# ) name (\\d)+ = ((.+)\"$|(.+)$)";There is a possiblity that the string either starts with "# and ends with ", or that it only starts with # and no special marker to the end. Can anyone enlighten me on the correct regex because the one I posted up there only works in the case of being surrounded by quotes. Thanks in advance!
    Christian A. Sueiras

    Try this: private static final String ColumnName = "^(\"?)# name (\\d+) = (.+)\\1$";{code} You match an optional quotation mark at the beginning, and capture it in group #1.  At the end, you match whatever was captured in group #1: either a quotation mark, or nothing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Parsing a text file using regular expression

    hi all,
    i have a text file which is delimited by a pipe symbol.
    eg.|4| |2| |1| |abcde| 345 |2000|...................
    can anyone help me writing the regular expression for the above case.
    Thanks

    Would splitting the string into tokens help you?
    String s = "|4| |2| |1| |abcde| 345 |2000|";
    String[] token = s.split("\\|");
    int len = token.length;
    for (int i=0; i<len; i++) {
         String t = token.trim();
         if (!t.equals("")) {
              System.out.println(t);

  • A regular expression question

    I have a large body of text which I am breaking into individual words (as part of an experimental indexing project.)
    I can break the text into a list by making a paragraph break for every word space (a simple find and replace).
    But I want proper names to remain unbroken.
    So I am trying to write a regular expression script which will find every occurence of two contiguous words which each begin in a capital letter, and then to replace the space between the two words with an underscore.
    So Sigmund Freud becomes Sigmund_Freud.
    Does anyone know how I would write this script?
    Thanks!!!

    You don't need a script, you can do it in the interface:
    Find: (\u[-\w]+)\x{20}(?=\u[-\w]+)
    Change: $1_
    \u[-\w]+ stands for "upper-case letter followed by one or more of hyphen/word character"; here the first name.
    \x{20} stands for the space.
    followed by another \u[-\w]+, the last name. This one is in a lookahead, so the whole expression paraphrases as "find a word that starts with an upper-case letter followed by a space if it's followed by another word starting with an uc letter".
    Peter

  • Help: Regular Expression question??

    Hello,
    How can I extract the following content using Java Regular expression?
    <tr bgcolor="#333333">
         <td class="title" colspan="4" height="18"> <b>SUPER_1</b> - SUPER_2</td>
    </tr>
    <tr bgcolor="#333333">
         <td class="match-light" width="45" height="18"> </td>
         <td class="match-light" colspan="3" width="286" align="right">March 19 </td>
    </tr>
    <tr>
         <td colspan="4" height="1"></td>
    </tr>
    <tr bgcolor="#cfcfcf">
         <td width="45" height="18"> FT</td>
         <td width="118" align="right">SUPER_3</td>
         <td width="50" align="center"><a class="scorelink" target="details" onclick="showDetails();">999 - 888</a></td>
         <td width="118">SUPER_4</td>
    </tr>From the above contents, How can I define a regular expression for extract the "*SUPER_1*", "*SUPER_2*", "*March 19*", "*SUPER_3*", "*999*", "*888*" and "*SUPER_4*" ????
    Please help.
    Best regards,
    Eric

    Kayaman wrote:
    Why not use a better way than regex, like an actual HTML parser (or XML if you have it well-formed)? People seem to love parsing (or rather, asking help how to parse) HTML with regex for some unknown reason.Indeed.
    Read this (hilarious):
    http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454

  • Quick regular expression question/help

    Can someone help me with two regular expressions I need. I could spend a while trying to figure it out myself, however times short and I really would like to get a fool proof optimal solution (my attempt would be buggy).
    Sample sentence
    The population, is projected to reach 200,000, or more (by 2020).[7] This is {dummy} text.
    The first regular expression
    I need all brackets and every thing between them to be removed from a sentence.
    Brackets such as: ( ), [ ] and { } .
    I.e. Given the above sentence the following would be returned:
    The population, is projected to reach 200,000, or more. This is text.
    The second regular expression
    If a word has a trailing comma character I need to add a whitespace between the word and the comma.
    I.e. Given the sentence returned from the first regular expression, this regex would return:
    The population *,* is projected to reach 200,000 *,* or more. This is text.
    Many thanks to anyonewho can help me with this!
    Edited by: Myles on Jan 18, 2008 8:12 AM

    http://java.sun.com/docs/books/tutorial/extra/regex/index.html
    http://www.regular-expressions.info

  • Regular Expression Question

    Hi all,
    I am suffering in java regular expression, and I hope you guys can help me out. I want to use the String api ".matches" to find out any string pattern like "xxxx.xxxx" where xxx can be only english word(both upper and lower case). Actually I will use this kind of expression to represent the cross join SQL statement in my java class, like "tableA.name = tableB.name", where they should be english letter only. I tried to use MyString.matches("^[A-Z] + \\. + ^[A-Z]") in my java program, but seem it doesn't work. Can you guys figure out the right expression for me ?? Many thanks
    Transistor

    Thanks for your prompt response, I tried your code, however, it doesn't work out.
    I put your code like the following:
    if ( searchCriteria.getStringPair().getValue().trim().matches("[A-Za-z]+\\.[A-Za-z]+") {...some action }.
    Seems the java program never reach this expression.
    Kindly remind that I wan to expression anything like "xxxxx.xxxxx" where xxxx can be a word.
    Myriads of thanks
    Transistor

  • 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

  • Date Validation (yyyy/MM/dd) Using Regular Expression

    Hi Friends,
    I want to validate date entered by user in yyyy/MM/dd format and for this I want to use Regular Expressions only. Also is there any tool that can be used to generate Regular Expression (for Win2000, Win NT)?
    Regards,
    Himanshu Rathore

    try this
    public class Test
         public static void main(String [] args)
              String regex = "\\d{4}/[01]\\d/[0-3]\\d";
              System.out.println("2003/12/11".matches(regex));
              System.out.println("2djd/kj3".matches(regex));
              System.out.println("22/12/12".matches(regex));
              System.out.println("2003/23/05".matches(regex));
              System.out.println("1999/12/51".matches(regex));
              System.out.println("2007/05/07".matches(regex));
    }i'm not able to try on it because i only have jdk1.3.1 installed on my computer and these codes
    required j2sdk1.4

Maybe you are looking for