Regular exp

Hello guys,
I have something like this in a particular column
/Jewel/Watches/ForHim/05645432454
Using regular exp, How can i select whatever is coming before /05645432454. My result should be "/Jewel/Watches/ForHim". Basically the rule is what ever coming before that last '/' in the column is to be selected.
Please help
Thanks
Edited by: user626688 on Aug 6, 2010 2:15 PM
Edited by: user626688 on Aug 6, 2010 2:15 PM

user626688 wrote:
Hello guys,
I have something like this in a particular column
/Jewel/Watches/ForHim/05645432454
Using regular exp, How can i select whatever is coming before /05645432454. My result should be "/Jewel/Watches/ForHim". Basically the rule is what ever coming before that last '/' in the column is to be selected.
Please helpJust for my clarification, "exp" is not the old Oracle export utility, correct? You are just looking for the SQL commands that will allow you to return what is in front of the last "/" character, correct?
The INSTR function is able to search from the last character position, and locate the right-most "/" character:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions068.htm
Something like this:
SELECT
  INSTR(COL1,'/',-1,1)
FROM
  T1;With the position known, you can then use SUBSTR to return the left portion of the string - starting at the first character and extending to 1 less than the character position that was previously found:
SELECT
  SUBSTR(COL1,1, INSTR(COL1,'/',-1,1) - 1)
FROM
  T1;Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.

Similar Messages

  • Regular exp. question...

    Hi,
    I wrote a basic function which implements a saving  of two text data into  user selected files. The user chooses  one file name and the program should have appended a _CH_B string to the user selected name and saved the second file with that new generated name. For some reason my regular expression part does not work even though i checked the reg. exression on a stand alone engine. Please see my attached program
    Message Edited by RSibagatullin on 07-30-2008 07:02 PM
    Attachments:
    TextSave2.vi ‏56 KB
    current_path_20070710.vi ‏13 KB

    I prefer less code.
    Maybe try something like in the attached. Modify as needed.
    (Seems oyu want to append, so add a few things inside the small FOR loop. )
    Message Edited by altenbach on 07-30-2008 08:49 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    TextSave2MOD.vi ‏18 KB

  • Problem with regular exp.

    i'm trying to write a program that prints
    lines from a string:
    Pattern p = Pattern.compile("^(.*)$", Pattern.MULTILINE);
    String s = "firstline\rsecondline\r";
    Matcher m = p.matcher(s);
    while (m.find()) {
    System.out.println("line: " + m.group());
    System.out.println("start: " + m.start());
    System.out.println("end: " + m.end());
    The problem is that i get an IndexOutOfBounds
    exception, thrown by m.find(). Seems like a bug
    to me. Or have i done something wrong?
    It doesn't happen if the string ends with '\n' or '\r\n'.

    It's a bug. Would you like to report it, or shall I? Whoever reports it, should do so quickly, if we want it to be fixed in Tiger. In the meantime, you can use the following as a workaround:Pattern p = Pattern.compile("(?<!.)(.*)$", Pattern.MULTILINE);

  • Regular Expression help required

    {color:#000000}Hi....
    I am having a product table in oracle with products like CZS20T and CZSS30T and so on....
    But for printing on the invoice we need only the product name without the micron thickness like CZS and CZSS{color}{color:#000000}
    I tried regular expression with....."select regexp_substr('CZSS20T','([[:digit:]]{2})') from dual"
    {color}
    and the result was "20"*...*
    But I cant figure out how to use regular expression to get only the product name.
    Maybe there is another way without using Regular exp...
    Please help....

    regexp_substr (prod, '[[:alpha:]]*')and an example:
    SQL> with x as
      2  ( select 'CZS20T' prod from dual union all
      3    select 'CZSS30T' from dual union all
      4    select 'A10CSD' from dual
      5  )
      6  select prod
      7       , regexp_substr (prod, '[[:alpha:]]*')
      8    from x
      9  ; 
    PROD    REGEXP_SUBSTR(PROD,'[[:ALPHA
    CZS20T  CZS
    CZSS30T CZSS
    A10CSD  A
    SQL> Edited by: Alex Nuijten on Jan 27, 2009 8:52 AM

  • Steps to export and import oracle 10g databse from AIX to AIX and LINUX

    Hi,
    I need the steps to export the oracle 10g database from AIX server to AIX server and LINUX server.
    Please give me all the steps as this is my first exort an import activity.
    thanks,

    For 10g there exist two ways to do so.
    1) Regular exp/imp.
    2) Data pump expdp/impdp.
    As this is your first export and import activity, relevant concept understanding is mandatory for you.
    Documentation Link
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14215/toc.htm
    Read the chapters 1,2,3 (Data pump expdp/impdp) and 19 (regular exp/imp). Good luck.

  • Regular_exp in oracle

    HI
    If i want to search only mountpoint name from file_name column from dba_data_files table..what condition shoud i have to use ?
    mount point name can be '/xyz91' OR '/xyz8'
    can any body tell me how do i use regular exp to search only '/xyz91' or '/xyz8' from file_name column which is actually '/xyz91/oradata/datafile01.dbf' and '/xyz8/oradata/datafile01.dbf'

    Hi,
    So you want to find the substring up to, but not including, the 2nd '/': is that right?
    You can do that easily enough, and more efficiently, without regular expressions:
    SELECT     file_name
    ,     SUBSTR ( file_name
                , 1
                , INSTR (file_name, '/', 1, 2) - 1
                )     AS mount_point
    FROM     dba_data_files
    ;Chances are, you have so few rows in dba_data_files that the difference in efficiency won't matter. In general, there's no point in paying for the extra power of reular expressions if you don't need it, and in this case, like many others, you don't.
    If you really need to use regular expressions, here's one way:
    SELECT     file_name
    ,     REGEXP_SUBSTR ( file_name
                    , '/[^/]+'
                    )          AS mount_point
    FROM     dba_data_files
    ; Edited by: Frank Kulash on Sep 22, 2011 11:30 PM
    Added REGEXP_SUBSTR example

  • Pattern Matching for a wildcard Ip address

    I m working on a project. And in it i get problem for pattern matching.I have ipv4 ip address for ex " 127.3.0.1* ".I have to generate regular exp for pattern matching in Java.Can you guide me what can be its regular exp.
    thanks,
    preeti

    preetiGupta wrote:
    I m working on a project. And in it i get problem for pattern matching.I have ipv4 ip address for ex " 127.3.0.1* ".I have to generate regular exp for pattern matching in Java.Can you guide me what can be its regular exp.Alternatively, [try this|http://lmgtfy.com/?q=regex+for+ipv4+addresses].
    Winston

  • Restrict Special Characters in String Fields

    Hello,
    My Jdev version is 11.1.1.6 using ADF BC and ADF Faces as technology stack.
    I have a requirement to restrict special characters, html tags as input in String/Varchar2 fields.
    I have couple of thoughts that can be used in application but not sure which is the best approach:
    1. Implement <af:validateRegExp pattern="regular Exp"> inside <af:inputText> component
    2. Implement Entity based validator using Regular Expression
    Apart from picking the best out of above two, I would like to know if there is a better way to implement this validation.
    My application has custom framework extn classes and all Entities/View Objects extend those. Is there a possibility to implement this type of validation at some central place.
    I would highly appreciate expert inputs here.
    Thanks,
    Jai

    Hi,
    the answer to your question is *"use both"*. The entity level would be enough but then would make people subniitting a request afte which they see an error The RegEx validator in ADF Faces handles problems on the client side and thus before a submit is sent to the server (where it then would be also checked using server side validation in ADF Faces). Why not using RegEx validation in ADF faces alone? Because there are potentially many views accessing your entity through view objects and if only one developer forgets the RegEx validator you would be screwed.
    Frank

  • Easyest way to "copy-paste" a schema with data?

    Hi,
    what is the easiest way to make a copy of a schema with data to another (new) schema?
    Thanks

    Hi Jernej Kase
    Q:what is the easiest way to make a copy of a schema with data to another (new) schema?
    A: Oracle 10g datapump’s Network_link option allows us to copy data between schemas without even creating an export dump file.
    I have tried this option and it reduced my copy procedure timings from 2 hours ( with regular exp/imp) to 15 mins.
    all you need to do is
    1. create a DB link pointing to target schema.
    2. run the impdb command
    example:
    impdp uname/pwd@dbname directory=<dir name> logfile=<logfile name> network_link=<dblink name> remap_schema=source_user:target_user parallel=2
    Krishna.B

  • Export  "sys.aud$"  table as system user using datapump

    Friends,
    I want to export (using datapump 'expdp') the sys user's AUD$ table (sys.aud$) as the system
    user . But it shows the following error :
    bash-3.00$ expdp system/sys123@onlinete directory=test_dir TABLES=sys.AUD$ DUMPFILE=sysaud.$Date.dmp logfile=audit.$date.log
    Export: Release 10.2.0.1.0 - 64bit Production on Wednesday, 14 January, 2009 13:30:56
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/********@onlinete directory=test_dir TABLES=sys.AUD$ DUMPFILE=sysaud..dmp logfile=audit..log
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 0 KB
    ORA-39165: Schema SYS was not found.
    ORA-39166: Object AUD$ was not found.
    ORA-31655: no data or metadata objects selected for job
    Job "SYSTEM"."SYS_EXPORT_TABLE_01" completed with 3 error(s) at 13:31:01
    It also shows error when I take it as SYS user :
    bash-3.00$ expdp sys/sys123@onlinete directory=test_dir TABLES=sys.AUD$ DUMPFILE=sysaud.$Date.dmp logfile=audit.$date.log
    Export: Release 10.2.0.1.0 - 64bit Production on Wednesday, 14 January, 2009 13:35:19
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    UDE-00008: operation generated ORACLE error 28009
    ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
    Username: sys/sys123 as sysdba
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    Starting "SYS"."SYS_EXPORT_TABLE_01": sys/******** AS SYSDBA directory=test_dir TABLES=sys.AUD$ DUMPFILE=sysaud..dmp logfile=audit..log
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 0 KB
    ORA-39165: Schema SYS was not found.
    ORA-39166: Object AUD$ was not found.
    ORA-31655: no data or metadata objects selected for job
    Job "SYS"."SYS_EXPORT_TABLE_01" completed with 3 error(s) at 13:35:29
    I dont understand the problem why it is not working . Need advice plz ... ...

    But that's not fair..
    Imagine the situation, where I figured out that some data was edited a year ago, but I don't know by whom.. Audit was enabled at that time, I was exporting (using the regular exp) AUD$ table during the year, everything is good.. BUT.. Two months ago I upgraded my DB to 11g. Hence I cannot use imp in order to restore the table and see what was going on a year ago.. That means that I always have to have an ability to create 10g database in order to use my AUD$ export??
    Is there any other way of backing up this table? Sop far I was doing exp+truncate, but since 11g release where exp/imp are not supported I am trying to think about another way of dealing with the audit...
    does anybody have ideas about it?
    thanks,
    M

  • Check box validation

    Hello all,
    I need to perform validations on text field. I have two check boxes and by checking any one or both of them, a combination of text fields appear. I want to write four validations and one of them is shown below. I just have the basic idea, can anyone help me in writing it the correct way and what validation method(sql, item not null, regular exp, etc) to select?
    BEGIN
    IF(check box 1 is checked and check box 2 is unchecked) THEN
    :P3_TEXT_FIELD_1 := required;
    :P3_TEXT_FIELD_2 := required;
    :P3_TEXT_FIELD_3 := null;
    END IF;
    END;
    thanks,
    Toopran

    Hello,
    Thanks for the suggestion. I am having the validation of the type function returning error text and this is the actual code that I am using in my application.
    BEGIN
    IF :P11_WRITING_OBJ_FLAG IS NULL AND :P11_LAB_SCIENCE_FLAG IS NULL THEN
    :P11_NOTE_4 := NULL;
    :P11_NOTE_5 := NULL;
    :P11_NOTE_6 := NULL;
    :P11_NOTE_8 := NULL;
    IF :P11_NOTE_1 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_2 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_3 IS NULL THEN
    return 'enter a value in the text field';
    END IF;
    END IF;
    IF :P11_WRITING_OBJ_FLAG IS NOT NULL AND :P11_LAB_SCIENCE_FLAG IS NULL THEN
    :P11_NOTE_1 := NULL;
    :P11_NOTE_2 := NULL;
    :P11_NOTE_3 := NULL;
    :P11_NOTE_8 := NULL;
    IF :P11_NOTE_4 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_5 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_6 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_7 IS NULL THEN
    return 'enter a value in the text field';
    END IF;
    END IF;
    IF :P11_WRITING_OBJ_FLAG IS NULL AND :P11_LAB_SCIENCE_FLAG IS NOT NULL THEN
    :P11_NOTE_4 := NULL;
    :P11_NOTE_5 := NULL;
    :P11_NOTE_6 := NULL;
    :P11_NOTE_7 := NULL;
    IF :P11_NOTE_1 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_2 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_3 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_8 IS NULL THEN
    return 'enter a value in the text field';
    END IF;
    END IF;
    IF :P11_WRITING_OBJ_FLAG IS NOT NULL AND :P11_LAB_SCIENCE_FLAG IS NOT NULL THEN
    IF :P11_NOTE_1 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_2 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_3 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_4 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_5 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_6 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_7 IS NULL THEN
    return 'enter a value in the text field';
    ELSE IF :P11_NOTE_8 IS NULL THEN
    return 'enter a value in the text field';
    END IF;
    END IF;
    END;
    :P11_WRITING_OBJ_FLAG IS NULL and :P11_LAB_SCIENCE_FLAG are the check boxes and P11_NOTE_1 to P11_NOTE_8 are the 8 text fields that I want to validate based upon which box is checked.
    I am getting this error when I enter some values in the text field and click on SAVE button:
    ORA-06550: line 70, column 4: PLS-00103: Encountered the symbol ";" when expecting one of the following: if The symbol "if" was substituted for ";" to continue. ORA-06550: line 70, column 22: PLS-00103: Encountered the symbol ";" when expecting one of the following: if The symbol "if" was substituted for ";" to continue. ORA-06550: line 70, column 73: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exit for goto if loop mod null pragm
         Error      ERR-1024 Unable to run "function body returning text" validation.
    Please help.
    thanks,
    Toopran

  • Help in RegExp

    hi
    i need to convert the code (0,0,2,84,69,93,76,49) as
    0,0,2,84,69,93,76,49.
    How can use the regular exp for this code
    ~~
    SK

    hi Logger ,
    var reg:RegExp = "\((.+)\)";
    var str:String = "(1,2,3,4,4,5).";
    trace(str.replace(reg, ""));
    whether it's correct way of approach.
    ~~
    Sk

  • Regular Expressions in num-exp

    Hello All,
    I had a problem on my SRST gateway with num-exp insterting a repeating pattern into my 7-digit dialing when in fallback mode.
    For a brief example, the 7digit internal dialing is 21621.. or 21622..
    The num-exp statement of 'num-exp 2... 2162...' was not allowing me to 7-digit dial directly from one IP phone to another while in fallback mode.
    When I dialed 2162154 the 2162 would hit the num-exp and be expended to 2162162.
    I have a work around that uses a voice translation-rule, applied to the call-manager-fallback config that will translate a 7-digit dialed string to the 4 digit dialed string which then hits the 4-digit to 7-digit num-exp and it is working fine.
    However, I was wondering if there is a way to  use regular expressions in num-exp so that perhaps I can skip the intermediate step of using the translation-rule. Based off my existing translation-rules that are working properly, I figured something like this might work for num-exp:
    'num-exp /^2\([12]..$\)/ /2162\1/'
    But when I try to issue a num-exp with a regular expression I get the following message.
    Incorrect format for Number macro pattern
            regular expression must be of the form  ^((\+)?([0-9#*A-F.]|(\\\*))+(\$)?)$
    I have tried a number of different combinations with no success.  I always get the same message.  The regular expression that I tried first was:
    'num-exp ^2... 2162...'
    This is when I first saw the "Incorrect format..." message and figured that is must be possible.  Is this just a generic warning similar to when you try to use complex regular expressions with the 'translation-rule' command vs. the 'voice translation-rule' command and in reality you cannot use regular expressions in the num-exp command?
    Thank you,
    Leo

    Hi Chris,
    Thank you for taking the time to answer my question.  It looks like the answer is no, num-exp does not support regular expressions.
    I don't insist on using num-exp for this I was just hoping to kill two birds with one stone and possibly skip the intermediate step of translating the 7-digits dial to 4-digits using a translation-rule just to expand from 4-digit to 7 again.  This is only an issue while in SRST if a user tries to dial using 7-digits.  We have a 7-digit internal dialing scheme and normally my num-exp is just to expand the 4 digits sent from the telco to our 7-digit internal dialing.  The problem is that both our prefix and part of our DID range start with 21 so while in SRST if a user tried to dial a 7-digit DN, say 2162154, after they dialed the 4th digit (2162) that pattern would hit the num-exp and get expanded to 2162162.  I was hoping to create a num-exp using a regular expression that would only expand a four digit string that begins with a 2 to seven digits and not any string that begins with a 2.  This would 1) expand the four digits sent from the telco and 2) not match a seven digit string that begins with a 2 such as 2162154 which may be dialed by a user.
    Again, this is only an issue while in SRST and I have a pretty good work around so I'm fine with not being able to use a regular expression as part of my num-exp config.  I just thought it would be a cool application of a regular expression if it was possible.
    Thanks again for answering my question.
    Leo

  • Regular timeouts and slow system

    Team,
    We are regularly getting timeouts for users on our IDES system.
    This is a dump of our ST02 screen:
    System:                  sap6ides_C10_00             Tune summary
    Date + Time of Snapshot: 18.08.2010      11:32:32    Startup:     20.04.2010 19:18:57
    Buffer             HitRatio % Alloc. KB Freesp. KB % Free Sp. Dir. Size FreeDirEnt % Free Dir    Swaps     DB Accs
    Nametab (NTAB)                                                                                0
       Table definition     98,50     6.798                          20.000                              0
       Table definition     98,50     6.798                          20.000                          4.638     193.422
       Field definition     99,59    51.563      7.928      15,86    20.000     12.853      64,27   36.873      44.444
       Short NTAB           99,74     3.625      1.741      58,03     5.000        905      18,10        0       4.095
       Initial records      58,43     6.625      3.770      62,83     5.000        756      15,12   49.952      54.196
                                                                                    0
    program                98,93   300.000      1.077       0,37    75.000     67.819      90,43  134.795     436.695
    CUA                    99,62     5.000      1.318      32,15     2.500      2.355      94,20  128.786       4.595
    Screen                 99,60     4.297                           2.000      1.671      83,55    1.612      11.290
    Calendar               99,99       488        260      55,20       200         98      49,00        0         102
    OTR                   100,00     4.096      3.375     100,00     2.000      2.000     100,00        0
                                                                                    0
    Tables                                                                                0
       Generic Key          99,97    58.594      3.647       6,39     5.000        221       4,42      180      95.637
       Single record        58,67    10.000        170       1,73       500        450      90,00    1.076  16.922.960
                                                                                    0
    Export/import          66,26     4.096        517      15,31     2.000        904      45,20  351.112
    Exp./ Imp. SHM         80,09     4.096      3.351      99,26     2.000      1.999      99,95        0
    SAP Memory      Curr.Use % CurUse[KB] MaxUse[KB] In Mem[KB] OnDisk[KB] SAPCurCach HitRatio %
    Roll area            4,20      2.519      6.400     60.000          0   IDs           99,99
    Page area            2,09      5.490    161.504     32.000    230.144   Statement    100,00
    Extended memory     21,39    503.808  2.256.896  2.355.200          0                  0,00
    Heap memory                        0          0    524.285          0                  0,00
    There is a lot of RED in the Swaps column. The box is a Windows Server with 4GB of memory allocated to it.  Any thoughts on where to start tuning this system?

    WOw ... Very unreadable format ... Can you repost question ... About time outs are you check the st03n load and know from here this long execution's are coming ? The DB you have are ?
    The box is a Windows Server with 4GB of memory allocated to it
    are is 32 bit? How you divided this 4 GB (how much for DB and for Application server)
    The 4 GB is to small are you trying for testing increae the rdisp/max_wprun_time ?
    Any other information?

  • Need help with regular expression

    I'm trying to use the java.util.regex package to extract URLs from html files.
    The URLs that I am interested in extracting from the HTML look like the following:
    <font color="#008000">http://forum.java.sun.com -
    So, the URL is always preceeded by:
    <font color="#008000">
    and then followed by a space character and then a hyphen character. I want to be able to put all these URLs in a Vector object. This doesn't seem like it should be too difficult but for some reason I can't get anywhere with it. Any help would be greatly appreciated. Thanks!

    hi gupta am not sure of the java syntax but i can tell u about the regular expression...try this....
    <font color="#008000">(http:\/\/[a-zA-Z0-9.]+) [-]
    i dont know the java methods to call...just the reg exp...
    Sanjay Acharya

Maybe you are looking for

  • ITunes not loading

    All of the sudden I can't sign in to iTunes,I get a message that reads:We could not complete your iTunes request.An unknown error occured(-50)There wan an error in iTunes store.Please try again later: Could someone give me a clue on whats happening?

  • MIRO PROBLEM IN FREIGHT CALCULATION

    DearAll, user have to do MIRO for a P.O , GRN done , User had done IV for material cost , but for Freight he is doing IV the weight of mat P.O  is 1700kg & charges for freight are Rs 4000/-, but good reciept is for 1670kg as per  invoice problem is t

  • BB Pearl 8220 flip - Questions??

    This might seem like a silly question but I just got this phone and I am still learning how to use it.  I have noticed that when I am in an application (ex. facebook or my contact list) and I flip my phone shut it does not end the application and ret

  • Backup full with DataPump without sys o system password

    Hi I am into the OS connected as oracle user which is the owner of the Oracle Software. I can connect to the database so : sqlplus / as sysdba without problems. Now I want backup full with DataPump and export utility without sys o system password. Ho

  • Cross Site Publishing and Variations: how to manage assets?

    We have a Cross-Site Publishing scenario: - an Authoring site collection with variations enabled, in order to manage content in English and Italian - two Publishing site collections - an Intranet Site Collection Intranet and Web site are feeded from