Regular expression alphabets

Hi
I want to retrieve the data if the data contains a character or a space or '-' thru select query .
Please help me in writing the combination of 3 with regular expression.
Thanks!!

VT wrote:
Hi,
Try this
SELECT *
FROM <TABLE> WHERE REGEXP_LIKE(<COLUMN>, '[a-z -][A-Z -]');cheers
VTThat won't work as it's expecting at least two characters with the first having to be a-z (lower case) or space or "-" followed by A-Z (upper case) or space or "-".
The correct way is either:
[a-zA-Z -]or
[[:alpha:] -]using the alpha set is often preferable as it can work differently with different character sets/languages rather than restricting to just the a-zA-Z ranges.
Generating a reference for your own database characterset/language can be useful...
SQL> select level-1 as asc_code, decode(chr(level-1), regexp_substr(chr(level-1), '[[:print:]]'), CHR(level-1)) as chr,
  2         decode(chr(level-1), regexp_substr(chr(level-1), '[[:graph:]]'), 1) is_graph,
  3         decode(chr(level-1), regexp_substr(chr(level-1), '[[:blank:]]'), 1) is_blank,
  4         decode(chr(level-1), regexp_substr(chr(level-1), '[[:alnum:]]'), 1) is_alnum,
  5         decode(chr(level-1), regexp_substr(chr(level-1), '[[:alpha:]]'), 1) is_alpha,
  6         decode(chr(level-1), regexp_substr(chr(level-1), '[[:digit:]]'), 1) is_digit,
  7         decode(chr(level-1), regexp_substr(chr(level-1), '[[:cntrl:]]'), 1) is_cntrl,
  8         decode(chr(level-1), regexp_substr(chr(level-1), '[[:lower:]]'), 1) is_lower,
  9         decode(chr(level-1), regexp_substr(chr(level-1), '[[:upper:]]'), 1) is_upper,
10         decode(chr(level-1), regexp_substr(chr(level-1), '[[:print:]]'), 1) is_print,
11         decode(chr(level-1), regexp_substr(chr(level-1), '[[:punct:]]'), 1) is_punct,
12         decode(chr(level-1), regexp_substr(chr(level-1), '[[:space:]]'), 1) is_space,
13         decode(chr(level-1), regexp_substr(chr(level-1), '[[:xdigit:]]'), 1) is_xdigit
14    from dual
15  connect by level <= 256
16  /
  ASC_CODE C   IS_GRAPH   IS_BLANK   IS_ALNUM   IS_ALPHA   IS_DIGIT   IS_CNTRL   IS_LOWER   IS_UPPER   IS_PRINT   IS_PUNCT   IS_SPACE  IS_XDIGIT
         0                                                                   1
         1                                                                   1
         2                                                                   1
         3                                                                   1
         4                                                                   1
         5                                                                   1
         6                                                                   1
         7                                                                   1
         8                                                                   1
         9                                                                   1                                              1
        10                                                                   1                                              1
        11                                                                   1                                              1
        12                                                                   1                                              1
        13                                                                   1                                              1
        14                                                                   1
        15                                                                   1
        16                                                                   1
        17                                                                   1
        18                                                                   1
        19                                                                   1
        20                                                                   1
        21                                                                   1
        22                                                                   1
        23                                                                   1
        24                                                                   1
        25                                                                   1
        26                                                                   1
        27                                                                   1
        28                                                                   1
        29                                                                   1
        30                                                                   1
        31                                                                   1
        32                       1                                                                            1                     1
        33 !          1                                                                                       1          1
        34 "          1                                                                                       1          1
        35 #          1                                                                                       1          1
        36 $          1                                                                                       1          1
        37 %          1                                                                                       1          1
        38 &          1                                                                                       1          1
        39 '          1                                                                                       1          1
        40 (          1                                                                                       1          1
        41 )          1                                                                                       1          1
        42 *          1                                                                                       1          1
        43 +          1                                                                                       1          1
        44 ,          1                                                                                       1          1
        45 -          1                                                                                       1          1
        46 .          1                                                                                       1          1
        47 /          1                                                                                       1          1
        48 0          1                     1                     1                                           1                                1
        49 1          1                     1                     1                                           1                                1
        50 2          1                     1                     1                                           1                                1
        51 3          1                     1                     1                                           1                                1
        52 4          1                     1                     1                                           1                                1
        53 5          1                     1                     1                                           1                                1
        54 6          1                     1                     1                                           1                                1
        55 7          1                     1                     1                                           1                                1
        56 8          1                     1                     1                                           1                                1
        57 9          1                     1                     1                                           1                                1
        58 :          1                                                                                       1          1
        59 ;          1                                                                                       1          1
        60 <          1                                                                                       1          1
        61 =          1                                                                                       1          1
        62 >          1                                                                                       1          1
        63 ?          1                                                                                       1          1
        64 @          1                                                                                       1          1
        65 A          1                     1          1                                           1          1                                1
        66 B          1                     1          1                                           1          1                                1
        67 C          1                     1          1                                           1          1                                1
        68 D          1                     1          1                                           1          1                                1
        69 E          1                     1          1                                           1          1                                1
        70 F          1                     1          1                                           1          1                                1
        71 G          1                     1          1                                           1          1
        72 H          1                     1          1                                           1          1
        73 I          1                     1          1                                           1          1
        74 J          1                     1          1                                           1          1
        75 K          1                     1          1                                           1          1
        76 L          1                     1          1                                           1          1
        77 M          1                     1          1                                           1          1
        78 N          1                     1          1                                           1          1
        79 O          1                     1          1                                           1          1
        80 P          1                     1          1                                           1          1
        81 Q          1                     1          1                                           1          1
        82 R          1                     1          1                                           1          1
        83 S          1                     1          1                                           1          1
        84 T          1                     1          1                                           1          1
        85 U          1                     1          1                                           1          1
        86 V          1                     1          1                                           1          1
        87 W          1                     1          1                                           1          1
        88 X          1                     1          1                                           1          1
        89 Y          1                     1          1                                           1          1
        90 Z          1                     1          1                                           1          1
        91 [          1                                                                                       1          1
        92 \          1                                                                                       1          1
        93 ]          1                                                                                       1          1
        94 ^          1                                                                                       1          1
        95 _          1                                                                                       1          1
        96 `          1                                                                                       1          1
        97 a          1                     1          1                                1                     1                                1
        98 b          1                     1          1                                1                     1                                1
        99 c          1                     1          1                                1                     1                                1
       100 d          1                     1          1                                1                  1                           1
       101 e          1                     1          1                                1                  1                           1
       102 f          1                     1          1                                1                  1                           1
       103 g          1                     1          1                                1                  1
       104 h          1                     1          1                                1                  1
       105 i          1                     1          1                                1                  1
       106 j          1                     1          1                                1                  1
       107 k          1                     1          1                                1                  1
       108 l          1                     1          1                                1                  1
       109 m          1                     1          1                                1                  1
       110 n          1                     1          1                                1                  1
       111 o          1                     1          1                                1                  1
       112 p          1                     1          1                                1                  1
       113 q          1                     1          1                                1                  1
       114 r          1                     1          1                                1                  1
       115 s          1                     1          1                                1                  1
       116 t          1                     1          1                                1                  1
       117 u          1                     1          1                                1                  1
       118 v          1                     1          1                                1                  1
       119 w          1                     1          1                                1                  1
       120 x          1                     1          1                                1                  1
       121 y          1                     1          1                                1                  1
       122 z          1                     1          1                                1                  1
       123 {          1                                                                                    1     1
       124 |          1                                                                                    1     1
       125 }          1                                                                                    1     1
       126 ~          1                                                                                    1     1
       127                                                                   1
       128 Ç          1                                                                                    1     1
etc.
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

Similar Messages

  • Help regarding regular expression

    HI All ,
    Please see the following string
    String s = "IF ((NOT NUM4 IS ALPHABETIC ) AND NUM3 IS ALPHABETIC-UPPER AND (NUM5 IS GREATER OR EQUAL TO 3) AND (NUM5 IS NOT GREATER THAN 3) AND (NUM3 GREATER THAN 46) AND (NUM5 GREATER THAN NUM3) OR NUM3 LESS THAN 78) .";
    My problem is: i want to capture the part of this line which contains "ALPHABETIC ,ALPHABETIC-UPPER for ex :NOT NUM4 IS ALPHABETIC , NUM3 IS ALPHABETIC-UPPER.from that I have to capture the word num4 , num3 which are in these phrases only ;from the whole string whereever it exists along with the phrase,Can any one help me out by suggesting something.num4 and num3 are variable names

    I suspect you're right, Sabre, but I can't resist...
    import java.util.regex.*;
    * A rewriter does a global substitution in the strings passed to its
    * 'rewrite' method. It uses the pattern supplied to its constructor, and is
    * like 'String.replaceAll' except for the fact that its replacement strings
    * are generated by invoking a method you write, rather than from another
    * string. This class is supposed to be equivalent to Ruby's 'gsub' when given
    * a block. This is the nicest syntax I've managed to come up with in Java so
    * far. It's not too bad, and might actually be preferable if you want to do
    * the same rewriting to a number of strings in the same method or class. See
    * the example 'main' for a sample of how to use this class.
    * @author Elliott Hughes
    public abstract class Rewriter
      private Pattern pattern;
      private Matcher matcher;
       * Constructs a rewriter using the given regular expression; the syntax is
       * the same as for 'Pattern.compile'.
      public Rewriter(String regularExpression)
        this.pattern = Pattern.compile(regularExpression);
       * Returns the input subsequence captured by the given group during the
       * previous match operation.
      public String group(int i)
        return matcher.group(i);
       * Overridden to compute a replacement for each match. Use the method
       * 'group' to access the captured groups.
      public abstract String replacement();
       * Returns the result of rewriting 'original' by invoking the method
       * 'replacement' for each match of the regular expression supplied to the
       * constructor.
      public String rewrite(CharSequence original)
        this.matcher = pattern.matcher(original);
        StringBuffer result = new StringBuffer(original.length());
        while (matcher.find())
          matcher.appendReplacement(result, "");
          result.append(replacement());
        matcher.appendTail(result);
        return result.toString();
      public static void main(String[] args)
        String s = "IF ((NOT NUM4 IS ALPHABETIC ) " +
                    "AND NUM3 IS ALPHABETIC-UPPER " +
                    "AND (NUM5 IS GREATER  OR EQUAL TO 3) " +
                    "AND (NUM5 IS NOT GREATER THAN 3) " +
                    "AND (NUM3 GREATER THAN 46) " +
                    "AND NUM645 IS ALPHABETIC " +
                    "AND (NUM5 GREATER THAN NUM3) " +
                    "OR NUM3 LESS THAN 78 " +
                    "AND NUM34 IS ALPHABETIC-UPPER " +
                    "AND NUM92 IS ALPHABETIC-LOWER " +
                    "AND NUM0987 IS ALPHABETIC-LOWER) .";
        String result =
          new Rewriter("(NUM\\d+) +IS +(ALPHABETIC(?:-(?:UPPER|LOWER))?)")
            public String replacement()
              String type = group(2);
              if (type.endsWith("UPPER"))
                return "Character.isUpper(" + group(1) + ")";
              else if (type.endsWith("LOWER"))
                return "Character.isLower(" + group(1) + ")";
              else
                return "Character.isLetter(" + group(1) + ")";
          }.rewrite(s);
        System.out.println(result);
    }

  • Password Validation using Regular Expression

    Please help me wit the regular expression for the password policy mentioned below:-
    The password length should at least be 8 characters. It should be a combination of at least any two of the given sets.
    a. Set of alphabets a-z, A-Z
    b. Set of numerics 0-9
    c. Set of special characters ~!@#$ etc.

    function validatePassword(fieldName,minNumberOfDigits, maxNumberOfDigits) {
    var alphaNumericPattern = "^[a-z0-9/_/$]{" + minNumberOfDigits + "," + maxNumberOfDigits + "}";
    var regExpr = new RegExp(alphaNumericPattern,"i");
    var sourceField = event != null ? event.srcElement:e.target;
    if(fieldName != null && fieldName != "null" && fieldName != "undefined") {
    sourceField = document.getElementById('OrdFrmsessionValidater:form1:passwordField2');
    var message = "Password must be a combination of alphabets and numbers";
    message = message + "\n and must be between " + minNumberOfDigits + " and " + maxNumberOfDigits + " chars.";
    var sourceFieldValue = sourceField.value;
    if(sourceFieldValue.length < minNumberOfDigits || sourceFieldValue.length > maxNumberOfDigits){
    alert(message);
    sourceField.focus();
    return false;
    if (!regExpr.test(sourceFieldValue)) {
    alert(message);
    sourceField.focus();
    return false;
    regExpr = new RegExp("[a-z/_/$]{1}","i");
    if(!regExpr.test(sourceFieldValue)){
    alert(message);
    sourceField.focus();
    return false;
    regExpr = new RegExp("[0-9]{1}","i");
    if(!regExpr.test(sourceFieldValue)){
    alert(message);
    sourceField.focus();
    return false;
    var alphaNumericPattern = "^[a-z0-9/_/$]{" + minNumberOfDigits + "," + maxNumberOfDigits + "}";

  • Functionality equivalent to Regular Expressions

    Hi,
    We have a old, very badly designed database(which by the way is the culprit of all the problems).
    There is a varchar2 column with values like -
    C500
    500FCG
    50-100
    MX
    ADW
    Y
    10-5
    500
    B1
    C500
    I am trying to retrieve only digits with no leading or trailing alphabets. But i still want numbers like 50-100.
    I know in 10g this could be easily done with regular expressions. But we are still using oracle 9i.
    Is it possible within the sql statement or is there any other way to do it(like using some perl programs calling from plsql).
    Any suggestions greatly appreciated.
    Thanks,
    Siri

    Sorry Mohana for not explaining my req clearly.
    Actually i was able to get the results by changing your query a little.
    Here is the query -
    select NVL(replace(translate(cov_limit, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','*'),' '), cov_limit) as After, cov_limit as Before
    from test;
    SQL> /
    BEFORE
    C500
    500FCG
    50-100
    MX
    ADW
    Y
    10-5
    500
    B1
    C500
    1000
    AMD
    CAD
    MAD
    WAT
    FCG
    CG
    AD
    DW
    A
    A500
    AFTER
    500
    500
    50-100
    MX
    Y
    10-5
    500
    1
    500
    1000
    FCG
    CG
    DW
    *500
    Only thing i am not able to understand is why the alphabet 'A' is not getting replaced with blank.
    Thanks & Regards,
    Sree

  • Regular Expression in ADF

    I have a requirement to validate one UI field with the following pattern. Can some one advise me about creating the correct pattern for the following requirement.
    It can have maximum of 8 characters. It can have only numbers, no - or [A-Z]. If there is -, then it should be only after 5th character. The last two characters must be alphabets.
    Example: 12, 1234, 12345, 78696, 12345-AB (Any number between 1 to 99999 and optional -[A-Z] )
    Can you please suggest regular expression for the above pattern.
    Thanks and Regards,
    S R Prasad

    Hi Hyangelo,
    I have tried the following regular expression suggested by you. I removed the end / as it is not accepting any valid pattern.
    <af:validateRegExp pattern="^[0-9]{0,5}(\1[0-9]{5}-[A-Z]{2}){0,1}$" messageDetailNoMatch="Invalid CPt Code..." />
    Thanks and Regards,
    S R Prasad

  • Pattern matching regular expressions

    I'm attempting to determine if a string matches a pattern of containing less than 100 alphanumeric characters a-z or 0-9 case insensitive. So my regular expression string looks like:
    "^[a-zA-Z0-9]{0,100}$"And I use something like...
    Pattern pattern = Pattern.compile( regexString );I'd like to modify my regex string to include the email 'at' symbol "@". So that the at symbol will be allowed. But my understanding of regex is very limited. How do I include an "or at symbol" in my regex expression?
    Thanks for your help.

    * Code by sabre150
    private static final Pattern emailMatcher;
        static
            // Build up the regular expression according to RFC821
            // http://www.ietf.org/rfc/rfc0821.txt
            // <x> ::= any one of the 128 ASCII characters (no exceptions)
            String x_ = "\u0000-\u007f";
            // <special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "."
            //              | "," | ";" | ":" | "@"  """ | the control
            //              characters (ASCII codes 0 through 31 inclusive and
            //              127)
            String special_ = "<>()\\[\\]\\\\\\.,;:@\"\u0000-\u001f\u007f";
            // <c> ::= any one of the 128 ASCII characters, but not any
            //             <special> or <SP>
            String c_ = "[" + x_ + "&&" + "[^" + special_ + "]&&[^ ]]";
            // <char> ::= <c> | "\" <x>
            String char_ = "(?:" + c_ + "|\\\\[" + x_ + "])";
            // <string> ::= <char> | <char> <string>
            String string_ = char_ + "+";
            // <dot-string> ::= <string> | <string> "." <dot-string>
            String dot_string_ = string_ + "(?:\\." + string_ + ")*";
            // <q> ::= any one of the 128 ASCII characters except <CR>,
            //               <LF>, quote ("), or backslash (\)
            String q_ = "["+x_+"$$[^\r\n\"\\\\]]";
            // <qtext> ::=  "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>
            String qtext_ = "(?:\\\\[" + x_ + "]|" + q_ + ")+";
            // <quoted-string> ::=  """ <qtext> """
            String quoted_string_ = "\"" + qtext_ + "\"";
            // <local-part> ::= <dot-string> | <quoted-string>
            String local_part_ = "(?:(?:" + dot_string_ + ")|(?:" + quoted_string_ + "))";
            // <a> ::= any one of the 52 alphabetic characters A through Z
            //              in upper case and a through z in lower case
            String a_ = "[a-zA-Z]";
            // <d> ::= any one of the ten digits 0 through 9
            String d_ = "[0-9]";
            // <let-dig> ::= <a> | <d>
            String let_dig_ = "[" + a_ + d_ + "]";
            // <let-dig-hyp> ::= <a> | <d> | "-"
            String let_dig_hyp_ = "[-" + a_ + d_ + "]";
            // <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
            // String ldh_str_ = let_dig_hyp_ + "+";
            // RFC821 looks wrong since the production "<name> ::= <a> <ldh-str> <let-dig>"
            // forces a name to have at least 3 characters and country codes such as
            // uk,ca etc would be illegal! I shall change this to make the
            // second term of <name> optional by make a zero length ldh-str allowable.
            String ldh_str_ = let_dig_hyp_ + "*";
            // <name> ::= <a> <ldh-str> <let-dig>
            String name_ = "(?:" + a_ + ldh_str_ + let_dig_ + ")";
            // <number> ::= <d> | <d> <number>
            String number_ = d_ + "+";
            // <snum> ::= one, two, or three digits representing a decimal
            //              integer value in the range 0 through 255
            String snum_ = "(?:[01]?[0-9]{2}|2[0-4][0-9]|25[0-5])";
            // <dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>
            String dotnum_ = snum_ + "(?:\\." + snum_ + "){3}"; // + Dotted quad
            // <element> ::= <name> | "#" <number> | "[" <dotnum> "]"
            String element_ = "(?:" + name_ + "|#" + number_ + "|\\[" + dotnum_ + "\\])";
            // <domain> ::=  <element> | <element> "." <domain>
            String domain_ = element_ + "(?:\\." + element_ + ")*";
            // <mailbox> ::= <local-part> "@" <domain>
            String mailbox_ = local_part_ + "@" + domain_;
            emailMatcher = Pattern.compile(mailbox_);
            System.out.println("Email address regex = " + emailMatcher);
        }Wow. Sheesh, sabre150 that's pretty impressive. I like it for two reasons. First it avoids some false negatives that I would have gotten using the regex I mentioned. Like, [email protected] is a valid email address which my regex pattern has rejected and yours accepts. It's unusual but it's valid. And second I like the way you have compartmentalized each rule so that changes, if any custom changes are desired, are easier to make. Like if I want to specifically aim for a particular domain for whatever reason. And you've commented it so that it is easier to read, for someone like myself who knows almost nothing about regex.
    Thanks, Good stuff!

  • Regular Expressions + using them in Vector analysis

    Hello,
    I would be very glad for any hint concerning this problem:
    Consider this ilustrational code sample
    import java.util.regex.*;
    Vector sequence = new Vector();
            sequence.add("-");
            sequence.add("-");
            sequence.add("A");
            sequence.add("-");
            sequence.add("B");I want to find the first occurence of any alphabetical character ...I thought I can do it like this:
    int index = sequence.indexOf("\\w");or from the other point of view like this:
    int index = sequence.indexOf("[^-]");Unfortunately none of these are working. Do you know why and how to fix this? There are supposed to be only alphabetical characters and "-" character...
    thanks a lot
    adam

    mAdam wrote:
    well, the code I posted above should suit only as an illustration of my problem.
    ActualIy I have a bunch of those sequences in an Arraylist...it can be from 5 - 100 sequences(vectors) and I need to use some methods which are available only for Collections (frequency(), insertElementAt()...etc.). I am not a proffesional programmer so I do hope that I am using it correctly instead of "simple" String[][] BunchOfSequences = {seq1,seq2,...}I am not aware of any frequency() or insertElementAt() methods in one of Java's collection classes.
    Is it possible to use regular expressions to find a first occurence of a "a-z"(or "A-Z"..it doesnt matter) in a vector then? Or I just need to find it in a "for loop"?
    thx
    adamRegexes only work on Strings, not on collections holding Strings. So yes, you will need to use a for statement (or similar).
    List<String> list = ...
    for(String s : list) {
      if(s.matches("\\w")) {
    }

  • Regular expressions for Spanish in CF 8

    Hi all
    I know that I can use [a-z] to check for any alphabets from a to z in CF 8. However, are there any regex to detect spanish alphabets like á, í, ó, é, ñ, etc.?
    Thanks in advance,
    Monte

    http://www.regular-expressions.info/unicode.html
    This might be helpful

  • Regular Expression for a Person's Name

    Hi,
    I am using the org.apache.regexp package and trying to find the regular expression for a person's name. It allows only the alphabetic string.
    I tried [a-zA-Z]+. But this also accepts the thing like "BUSH88", which is not what I want...
    Can anybody help me figure this out?
    Thanks in advance,
    Tong

    Hi,
    I am using the org.apache.regexp package and trying to
    find the regular expression for a person's name. It
    allows only the alphabetic string.
    I tried [a-zA-Z]+. But this also accepts the thing
    like "BUSH88", which is not what I want...
    Can anybody help me figure this out?
    Thanks in advance,
    Tongtry this:
    ^[a-zA-Z]+$
    the ^ represents the start of the String and the $ represents the end.
    So the expression is saying: "between the beginning and the end of the String there will only be alphbetical characters"

  • Regular Expression Exclude Certain Characters

    I am building this with Apex 3.2
    I have a validation on a page item of type regular expression
    Validation Expression 1 :   P13_TARGET_BMI
    Validation Expression 2:    ^[[:alnum:]-]*$
    This allows all characters, number and the - symbol
    Now I need to exclude certain alpha characters, ie German letters Ä Ü Ö
    and spaces if possible
    Basically if the user types in Ä, Ü, Ö, the validation should fail
    Cheers
    Gus

    Hi, Gus,
    The most efficient thing would be to list all the acceptable characters instead of using [:alnum:].
    REGEXP_LIKE ( str
                , '^[a-z0-9A-Záéíóúæ... -]+$'
    If you can't do that, then use a separate test to check for the exceptional alphabetic characters
         REGEXP_LIKE ( str
                     , '^[[:alnum:] -]+$'
    AND  str = TRANSLATE ( str
                         , 'xÄÜÖ'
                         ,'x'
    You can use regular expressions for the Ä Ü Ö testing, if you want to.
    There's nothing tricky about spaces; by default, they have no special meaning in regular expressions, and they never have any special meaning inside square brackets.

  • Field validation by regular expressions?

    Hi everyone,
    I just started with SoD and I'd like to ensure that some field values consists of alphabetic characters only (FirstName, LastName...). I failed to create an adequate expression. Is there a possibility to use regular expressions?
    TIA
    Michael

    quote:
    Originally posted by:
    Luckbox72
    The problem is not the Regex. I have tested 3 or 4 different
    versions that all work on the many different test sites. The
    problem is it that the validation does not seem to work. I have
    changed the patter to only allow NA and I can still type anything
    into the text box. Is there some issue with useing Regex as your
    validation?
    Bear in mind that by default validation does not occur until
    the user attempts to submit the form. If you are trying to control
    the characters that the user can enter into the textbox, as opposed
    to validating what they have entered, you will need to provide your
    own javascript validation.

  • Phone number Regular expression Help

    Hi,
    I am trying to validate phone number using regular expression.
    The format shoud be either of the two given below. It should not
    accept phone number of any other format other than the once given below.
    I tried out the following regular expression
    pn.matches("[\p{+}][0-9]+ ")
    but it accepts alphabets too(which is wrong).
    How do i check if the phone number is of the following format(OR condition).
    0401234567
    +358501234567
    Any help would be kindly appriciated.
    Thanks
    Sanam

    There will probably be much more constraints on you phone numbers, but here's a start:String[] numbers = {"0401234567",      // should be ok
                        "040123456",       // wrong, one number too little
                        "+358501234567",   // should be ok
                        "+3585012345670",  // wrong, one number too much
                        "+35850123456"};   // wrong, one number too little
    String regex = "\\+[0-9]{12}"+         // a + sign, followed by 12 numbers
                   "|"+                    // OR
                   "0[0-9]{9}";            // a zero, followed by 9 numbers
    for(String n : numbers) {
      System.out.println("Is "+n+" valid? "+n.matches(regex));
    }

  • Regular Expression for filename

    I want to read XML files,If the filename starts with an alphabet.
    Can anybody tell the regular expression for the same.
    Regards
    V Kumar
    Message was edited by:
    user640551

    thanks dhrmendra,
    i got the solution and correct expression is "[a-zA-z].\*.xml"
    regards
    V Kumar

  • Regular expressions for file/FTP transport within OSB.  How?

    The OSB transport/polling guides say for the FILE, FTP and SFTP transports that the "File Mask" can be a Regular Expression but I can't get it to pick up files this way. Is there some trick to enabling regular expression mode or some strange syntax required?
    For example I set up a very simple pattern of [A-Z]+ which should match any filename with one or more uppercase alphabetic characters only, but it does not pick up anything. It seems only to support the usual wildcard * operator in the non-regular expression mode.
    Any help much appreciated.

    Good point, but if you think about this description, you have to realize it just doesn't make sense. Again ...
    Enter a regular expression to select the files that you want to pick from the directory. The default value is \*.*The problem is that \*.* is not a regular expression at all. :-)
    1. The documentation is a mess in this particular point.
    2. FTP servers (at least those I have experienced) don't have a support for regular expressions.
    So I guess you can use only wildcards and not regular expressions with FTP transport.

  • Regular expression: numbers and letters allowed

    How can i determine best way following: input string may contain only numbers and letters, letters can be from any alphabet.
    Examples:
    '123aBc' - correct, only numbers and letters
    '123 aBc' - wrong, contains space
    '123,aBc' - wrong, contains comma
    'öäüõ' - correct, contains letters from Estonian alphabet.
    'abc' - correct, contains letters from english alphabet.
    I think i should use function "regexp_like" for that, because LIKE-operator can't do such things, correct?
    How i should write the regular expression then? I'm new to reg expressions.

    CharlesRoos wrote:
    How can i determine best way following: input string may contain only numbers and letters, letters can be from any alphabet.
    Examples:
    '123aBc' - correct, only numbers and letters
    '123 aBc' - wrong, contains space
    '123,aBc' - wrong, contains comma
    'öäüõ' - correct, contains letters from Estonian alphabet.
    'abc' - correct, contains letters from english alphabet.
    I think i should use function "regexp_like" for that, because LIKE-operator can't do such things, correct?
    How i should write the regular expression then? I'm new to reg expressions.I'm not too hot on the foreign alphabets, but something like:
    regexp_like(txt, '^[[:alpha:][:digit:]]*$')should do it I think.

Maybe you are looking for