Simple question about regular expression

Hi
I have a little problem with
select regexp_substr('123 Mapla Avenue','[a-z]') my_test from dual;
answer: M
I excecute this query in SQLPlus and SQL Developer result is this same.
select regexp_substr('123 Mapla Avenue','[M]') my_test from dual;
answer: M
select regexp_substr('123 Mapla Avenue','[a]') my_test from dual;
answer: a
I used oracle 10g
Thanks for your help

hm wrote:
In the oracle documentation of regexp_substr you can find:Do not confuse pattern and sort. Pattern [a-z] means any lowercase letter. REGEXP_SUBSTR parameter match_param value i tells REGEXP to treat uppercase letters same as lowercase letters and vice versa. And setting NLS_SORT can do the same. As you can see it is not that straight-forward. To make it transparent use exact pattern you need. In this particular case use:
select regexp_substr('123 Mapla Avenue','[[:alpha:]]') my_test from dual;where class [:alpha:] is POSIX predefined class of all letters (regardless of case). This way you are not dependent of client side settings like NLS_SORT and the above will always return first letter within a string. If you want first uppercase letter use:
select regexp_substr('123 Mapla Avenue','[[:upper:]]') my_test from dual;Or, for first lowercase letter:
SQL> alter session set nls_sort=binary;
Session altered.
SQL> select regexp_substr('123 Mapla Avenue','[a-z]') my_test from dual;
M
a
SQL> select regexp_substr('123 Mapla Avenue','[[:lower:]]') my_test from dual;
M
a
SQL> alter session set nls_sort=binary_ci;
Session altered.
SQL> select regexp_substr('123 Mapla Avenue','[a-z]') my_test from dual;
M
M
SQL> select regexp_substr('123 Mapla Avenue','[[:lower:]]') my_test from dual;
M
a
SQL> SY.

Similar Messages

  • Simple question about regular expressions

    Hi,
    Using Java's regular expression syntax, what is the correct pattern string to detect strings like the following :-
    AnnnnnA
    where A = a single (fixed) alphabetic character and
    n = at least one but possibly many digits [0-9].
    Example strings to be searched :-
    A45A (this should match)
    A3A (this should match)
    A3446655577A (this should match)
    A hello world A (this should NOT match as no digits are present between the A's).
    Thanks.

    A least one digit "A.*\\d.*A"
    Only digits "A\\d+A"

  • Question about Regular Expressions, please help!

    I have created an app which reads files and extracts certain data using regular expressions in JDK1.4 using Pattern and Matcher classes.
    However it needs to run on JDK1.2.2 (dont ask). The regular expression classes are not available in 1.2.2 (the Pattern and Matcher class) so i am looking for something similiar which i can use?
    I need something that loops through all the matches found in the file like how Matcher works i.e.
    while (matcher.find())
    // do this
    Help!

    http://jakarta.apache.org/regexp/

  • Basic question about regular expressions

    Hello,
    I am a beginner to regular expressions. I want to rewrite the following expression:
    public static final String REGULAR_EXP_SOFTWARE_PART_NUMBER = "([0-9]{7}[a-z]{1})(\\-{1})([a-z]{1})";I want THIS match
    (\\-{1})to occur EITHER if a hyphen is encountered OR if a space is encountered (instead of just the hyphen).
    How do I rewrite this?
    Thanks in advance,
    Julien.

    Hello and thanks for your feedback,
    I have created a small class as follows:
    package regExpr;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    * @author Martin
    public class RegExprTest {
         private static String stringToBeParsed = "3800157w-e26";
         public static void main(String[] args) {
              Pattern pattern = Pattern.compile("" +
                        "([0-9]{7})" +
                        "([a-z]{1})" +
                        "(( |-){1})" +
                        "([a-z]{1})" +
                        "([0-9]{2})" +
              Matcher matcher = pattern.matcher(stringToBeParsed);
              while(matcher.find()){
                   System.out.println(matcher.group(1));
                   System.out.println(matcher.group(2));
                   System.out.println(matcher.group(3));
                   System.out.println(matcher.group(4));
                   System.out.println(matcher.group(5));
                   System.out.println(matcher.group(6));
    }the class is trying tobreak down the following string "3800157w-e26" as follows:
    3800157(seven digits)
    w(one letter)
    -(hyphen)
    e(one letter)
    26(two digits)
    Oddly enough the output of the class is as follows:
    3800157
    w
    e
    26
    I have to call the group method six times and I get two hyphens!
    Can anyone help?
    Thanks in advance,
    Julien

  • One question about Regular Expression!!!

    I need to creat such a regular expression to match the format "[ ][ ][ ]".
    For example, there is a context,
    (1), " The project manager defines [1][0.400][+goals] for iterations."
    Suppose that there are some spaces or "\n" characters in this way,
    (2), " The project manager defines [    1 ] [  0.400   ]
    [   +goals] for iterations."
    If the pattern match the format succefully, (2) strings should be replaced by (1)strings, in order words, the format of (1) is what I need finally,
    I had ever tried creating a regular expression likes \\[([^\n\s]]+)\\]\\[([^\n\s]]+)\\]\\[([^\n\s]]+)\\] , but it does not work well!
    DO YOU HOW TO IMPLEMENT IT IN JAVA?
    Thanks for your any reply!

    What I really need is that, via the regular
    expression, all the spaces and \n characters in
    square brackets [ and ], ] and [, will be thrown
    away.
    For example,
    Original:
    1) "The project manager defines [   1  ] [
    0.400 ]
    [   +goals] for iterations with the support"
    After matching:
    2) "The project manager defines [1][0.400][ [+goals]
    for iterations with the support"
    String 2) is what I need finally!
    Thanks for your any reply!Well I gave you the answer to that one already :-)
    If you need to preserve the spaces in between words use this one. I'm sure there's a better way to do it, I'm no RegEx master.
        public static void main(String[] args)
            String s = "[ 1 ] [ 0.400 ]\n[ +go als]";
            System.out.println( "Before: " + s );
            System.out.println( "\n\n" );
            s = s.replaceAll( "\\[\\s+", "[" );
            s = s.replaceAll( "\\s+\\]", "]" );
            s = s.replaceAll( "\\]\\s+\\[", "][" );
            System.out.println( "After: " + s );
        }

  • Beginner question about Regular expression

    Hi all !
    I'd like to use a regular expression to parse a string like this:
    *<ID>4</ID><GROUP>5</GROUP>....*
    So for example to retrieve the ID I have built the following regular expression:
    Pattern p = Pattern.compile("<ID>(.*?)</ID>");  
    Matcher m = p.matcher(handle);    
    if (m.find()) {
          System.out.println("->"+m.group());     
    } else {
    System.out.println("No match!");   
    }The function m.group returns "<ID>4</ID>" but I want just the value (4) between the tag. Is there
    a way to get it ?
    thanks a lot
    mark

    fmarchioniscreen wrote:
    thank you very much, that's exactly what I needed.
    But it looks like you're parsing some XML like data: probably better to use a proper parser on it. Well it's a very short string containing XML tags. it's used in a marginal area of the application so I prefer just using a regular expression to fetch the values
    thanks again
    MarkYou could use XPath to get the value.

  • An additional question about regular expressions with String.matches

    does the String.matches() method match expressions when some substring of the String matches, or does it have to match the entire String? So, if i have the String "123ABC", and i ask to match "1 or more letters" will it fail because there are non-letters in the String, but then pass if i add "1 or more letters AND 1 or more digits"? so, in the latter every character in the String is accounted for in the search, as opposed to the first. Is that correct, or are there ways to JUST match some substring in the String instead of the whole thing? i WILL make some examples too... but does that make sense?

    It has to match the whole String. Use Matcher.find() to match on just a sub-string()

  • Question about Regular Expressions

    Hi averyone!
    Could any one help me to create RegEx for string: <object>
    Thanks!
    Kind Regards, Dmitry.

    "<object>"

  • Off Topic: Books about Regular Expression

    Hi
    Somebody can to indicate books about Regular Expression in Oracle ?
    Thanks

    Regex tag of Blog of Volder.
    http://volder-notes.blogspot.com/search/label/Regular%20Expressions
    This entry mentions my regex solution :-)
    http://volder-notes.blogspot.com/2007/10/removing-duplicate-elements-from-string.html
    By the way
    My regex homepage mentions regex problems of perl like regex (regex of EmEditor).
    http://www.geocities.jp/oraclesqlpuzzle/regex/
    example questions (written by Japanese language)
    http://www.geocities.jp/oraclesqlpuzzle/regex/regex-2-1.html
    http://www.geocities.jp/oraclesqlpuzzle/regex/regex-3-5.html
    http://www.geocities.jp/oraclesqlpuzzle/regex/regex-4-4.html

  • Simple question about mount and delay script

    Hello, I have a simple question about mounting volumes on start up.
    My computer wakes up auto - and then auto there are serveral applescript tasks (mount and start up programs)
    I use this script (daily) for serveral connections with external volumes I always need the connect to. ( In the script I use this code 3 times for other locations) I do this on start up.
    set Uname to "XXX"
    set Pword to "XXX"
    set someVolume to "afp://XXX.XXX.XXX.XXX/XXX/XXX
    mount volume someVolume as user name Uname with password Pword
    (same code for 2 other locations)
    When i do this on start up sometimes the script says there is no connection possible. I guess it's because on start up the connection isn't there. And 1 minute later when computer is total ready the connection is ok. When I run the script then It works. Just sometimes ( In the morning) 'It' want to connect but the script stops. When i do it manually(I run the script again) it works just fine.
    Is it possible that I need a delay? Can someone explain this?
    How would I make a delay handler for this script? Is that the best solution?
    Thanks in advance. This is something small i'm wondering about.
    Colin

    BTW, If you saved the script as an application +(and not as an application bundle)+ you could drop the script on to *Drop Script Backgrounder* (freeware).
    Then the script would run in the background, so, you wouldn't see it running in the Finder.
    <http://www.macupdate.com/info.php/id/7922/drop-script-backgrounder-x>
    Tom

  • A simple question about combo box

    Dear All,
    Just got a simple question about combo box: I have one of these selectors with labels based on filtered rows from a table.
    Is it possible to have one more label that would select all options?
    Like:
    Product A
    Product B
    Product C
    All Product
    Many thanks for your help!
    Gilles

    Hi Gilles,
    The purpose of ComboBox itself to select single option out of many.
    For your purpose, you may have to use "List Builder" which can accomodate 1 or more  to select.
    Please revert for more clarification if you need.
    With best wishes
    BaaRaa.

  • A simple question about performance!

    Hi! I have a simple question about performance. Suppouse that you have a servlet or a class with DB access, and you need to use a value several times in that page. What is best, to assign the value from say, a resultset or a request.getParameter() to a variable or to call the resultset or the request every time you need to retrieve that value? Which option uses less memory, which is faster, etc.?
    Hoping the best fou u
    Raul

    If you need more values from a db, the best is to open some connections (connection pool) and use the for accessing the db.
    To get the data only once, open the connection, get the data, store the data whereever you want: variable (class), hidden control (if you want to send from one page to another by request) and close the connection as quicky as possible.
    The advantage of the first method is that the most time consuming activity (connections opening) is done only once.

  • Two Questions about Airport Express

    All, I am a recent convert to using a Mac so bear with me.
    I have two questions about the Airport Express.
    Question if I buy one in the USA, I will visiting this week on holiday,can I use it the UK with a UK adaptor/apple plug?
    Can the Express be used with my current wireless network, using a Netgear DG834G V4, I have read lots in the forums about putting a $ sign in front of the WPA password?
    Any help and advice gratefully received.

    Tesserax wrote:
    Hello andixbox. Welcome to the Apple Discussions!
    Question if I buy one in the USA, I will visiting this week on holiday,can I use it the UK with a UK adaptor/apple plug?
    Yes, but at least two things to consider:
    o The US version of the 802.11n AirPort Express Base Station (AXn) only supports radio channels 1-11 in the 802.11g radio mode. Channels 12-14, used in other countries outside the US will not be available.
    o The AXn supports both the 2.4 and 5 GHz radio bands for 802.11n. The 5 GHz band is restricted in certain countries (like the UK) so operating in this mode may get you unwanted attention.
    That should be okay then because the Netgear broadcasts on channels 1-11. I hadn't appreciated the 5 Ghz band, but having checked both US and UK Apple sites the techspecs both mention 2.4 Ghz and 5 Ghz.
    Can the Express be used with my current wireless network, using a Netgear DG834G V4, I have read lots in the forums about putting a $ sign in front of the WPA password?
    If your intent is to have the AXn join the Netgear as a wireless client, then yes it should work. The "$" requirement was for WEP. This shouldn't be necessary for WPA or WPA2.
    I intended to use the AXn as an range extender, but you mention wireless client, is that something different?

  • Simple question about flex and AS 3.0

    Hi, this might sound like a simple question so I apologize...
    I have both a copy of flex 2 and 3, and i want to simply code in AS
    3.0 not mxml. I referred to the help of both flex 2 and 3, and all
    i could come up with is "you can add dynamic behavior to your
    documents using actionscript", which means to me, you only write
    your functions in AS and create instances with mxml (...ugh).
    personally, i find mxml to be ugly (mainly because it looks like
    html to me), and i'd rather not use it. coming from programming in
    an IDE in Java, it seems like it would be nicer to have something
    similar, all the while having the power and cool features of flash.
    I'm not fully educated in this matter so i understand that i could
    be totally wrong.
    i mean, if i have to code in mxml, i will. i'm a web
    programmer for a living, and if a more experience programmer said
    something like "if you don't code mxml in flex, you'll never get a
    job coding in flex", i would trust the advice, and learn the ugly
    code. :)
    yes, i do have Flash cs3, it's great but it seems like a pain
    to me the way you organize classes.... i've only seen a few
    tutorials, ones that explain how you cannot simply import a custom
    class, you have tell your movie to link to it, put it in the same
    directory, or manually name the package, it's sort of confusing.
    my main point here is that i'm very eager to start building
    apps in straight AS 3.0 instead of using flash cs3 (for some
    projects), and it would be cool to get some help or be pointed in
    the right direction.
    to simplify:
    can i write AS 3.0 and only as 3.0 in flex 2 or 3? how? can
    you link me to a tutorial? any advise?
    thanks!

    Hey William, thanks for the post. It's a great coincidence
    because I'm reading that book as well. I'm about half way through
    it, and I love it. I installed mxmlc on my linux box and am writing
    pure AS 3 apps. I think that's the way to go, though I know it's
    not for everybody.
    My problem with mxml is that it has a weird syntax for
    function calls, and it's not as 'intuitive' for a person like me,
    who came from C++ and Java programming in the past. I like writing
    programs in the C++ and Java style syntax, and since so many other
    languages use a similar syntax, I don't see any reason to learn the
    nuances of mxml, unless I was getting paid to do it. As far as I
    can tell there is no benefit.
    I hate using Flash to write flash apps as well, I feel like
    they become messy and confusing, especially when trying to write an
    OOP application. I only use it if I want to move an object in a
    very specific way and can't do it with the Tween methods.

  • Question in regular expressions

    Hi,
    I have this string (abdcerpabdcerpabdcerpaabdcerpabdcerp)
    and i want to this string abdcerp and may be followed by one or more a's
    So i want to get these results:
    abdcerp
    abdcerp
    abdcerpa
    abdcerp
    abdcerp
    I know regular expressions very well but i failed to generate one that can do so. I tried using this regex (abdcerpa*?) but it failed. it's not working and i dont know why, it's not getting abdcerpa. It only gets abdcerp
    can anyone help me with that telling me the reson why did this regex is not good or tell me a regex for doing so. But I need it to be tested cause I already know about the concepts and tried different ways and regexs but failed
    thanks
    bye

    That forum was retired and is now read-only. According to the announcement;
    Any future posts on this topic should be put in the 
    .NET Framework Class Libraries forum.
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

Maybe you are looking for

  • ITunes Makes Me Log in Every Time I Open It

    iTunes v. 12.0.1.26 and Yosemite updates recently installed. 2012 27" iMac iTunes makes me log in every time I open it. I thought the problem was fixed in THIS THREAD and it was a very helpful set of instructions by Linc but the problem keeps recurri

  • Converting the type from FLTP

    Hi, i'm entering a range i.e low value and high value in one of the transaction. when i'm saving its getting stored in a field of type FLTP 16 in the table. if i enter 10, its getting stored as 2.8314999999999998E02 and for 25, 2.9814999999999998E02.

  • How can I shut off software update prompts

    Hello, We use iPads - mostly 2nd gens - at some customer sites for tracking times. The devices are in kiosk cases, locked down, no access to the Home button, gestures shut off, etc, etc. Essentially, once on the screen we wanted displayed, there is n

  • HT1338 i have a ibook 1.3g. What is the highest OS I can install

    i have a ibook 1.3g. What is the highest OS I can install

  • Import Scenarios - Keep folder structure

    When I import a scenario folder the scenarios get inserted into the root of the Scenario pane and lose the folder they where in - Is this normal behaviour ? Is there a way to keep the folder structure? Its a royal PITA to drag and drop again as im wo