Replace part of a string

I want to replace a part of a string value with another in table column(VARCHAR). For example \\server01\data\doc\123.eps with \\server02\data\doc\123.eps . How to replace the server01 part with server02?

Use REPLACE.
Cheers, APC
SQL> select replace('\\server01\data\doc\123.eps', 'server01', 'server02')
  2  from dual
  3  /
REPLACE('\\SERVER01\DATA\DO
\\server02\data\doc\123.eps
SQL>

Similar Messages

  • CS3: grep search to replace part of a string

    Can I do a grep search for a string of text but only replace a portion of the string while leaving the remainder intact?
    iMac G5, OS 10.5.5

    In addition to Eric:
    Find "some search string", Replace "some replacement string " also replaces part of the string, not touching anything...
    But the GREP search has two advantages: First, if you define formatting in the Replace field (italics, superscript, a character style), only the 'search'/'replacement' part will be affected, rather than the entire found string (as in regular search).
    The second big advantage is you can use any regular GREP single character wildcard in the 'left' and 'right' (matching-but-not-marking) parts. A few useful examples: '\d' (digit), '\l' and '\u' (lowercase and uppercase), '.' (any character), or even '[a-f]' (lowercase 'a' to 'f'). The only limitation is that you cannot use the once, zero-or-more, or once-or-more modifiers -- the strings must have a fixed length. FYI, those three modifiers are, respectively, ?, *, and +.
    This restriction does not apply to the 'middle' string, the one you are going to replace anyway -- use whatever GREP you want.

  • How to replace part of a String with another String :s ?

    Got a String
    " Team_1/Team_2/Team_3/ "
    And I want to be able to rename part of the string (they are seperated by '/'), for example I want to rename "Team_3" to "Team C", and "Team_1" to "Team A" while retaining the '/' character how would I do this?
    I have tried using String.replace(oldValue, newValue); but this doesnt work, any ideas?

    What do you mean that it doesn't work? You do know that the method returns the modified string? The actual string that you invoke the method on is not altered.
    /Kaj

  • Find & replace part of a string in Numbers using do shell script in AppleScript

    Hello,
    I would like to set a search-pattern with a wildcard in Applescript to find - for example - the pattern 'Table 1::$*$4' for use in a 'Search & Replace script'
    The dollar signs '$' seem to be a bit of problem (refers to fixed values in Numbers & to variables in Shell ...)
    Could anyone hand me a solution to this problem?
    The end-goal - for now - would be to change the reference to a row-number in a lot of cells (number '4' in the pattern above should finally be replaced by 5, 6, 7, ...)
    Thx.

    Hi,
    Here's how to do that:
    try
        tell application "Numbers" to tell front document to tell active sheet
            tell (first table whose selection range's class is range)
                set sr to selection range
                set f to text returned of (display dialog "Find this in selected cells in Numbers " default answer "" with title "Find-Replace Step 1" buttons {"Cancel", "Next"})
                if f = "" then return
                set r to text returned of (display dialog "Replace '" & f & "' with " default answer f with title "Find-Replace Step 2")
                set {f, r} to my escapeForSED(f, r) -- escape some chars, create back reference for sed
                set tc to count cells of sr
                tell sr to repeat with i from 1 to tc
                    tell (cell i) to try
                        set oVal to formula
                        if oVal is not missing value then set value to (my find_replace(oVal, f, r))
                    end try
                end repeat
            end tell
        end tell
    on error number n
        if n = -128 then return
        display dialog "Did you select cells?" buttons {"cancel"} with title "Oops!"
    end try
    on find_replace(t, f, r)
        do shell script "/usr/bin/sed 's~" & f & "~" & r & "~g' <<< " & (quoted form of t)
    end find_replace
    on escapeForSED(f, r)
        set tid to text item delimiters
        set text item delimiters to "*" -- the wildcard 
        set tc1 to count (text items of f)
        set tc2 to count (text items of r)
        set text item delimiters to tid
        if (tc1 - tc2) < 0 then
            display alert "The number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string."
            error -128
        end if
        -- escape search string, and create back reference for each wildcard (the wildcard is a dot in sed) --> \\(.\\)
        set f to do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g;s/\\*/\\\\(.\\\\)/g' <<<" & quoted form of f
        -- escape the replacement string, Perl replace wildcard by two backslash and an incremented integer, to get  the back reference --> \\1 \\2
        return {f, (do shell script "/usr/bin/sed -e 's/[]~$.^|[]/\\\\&/g' | /usr/bin/perl -pe '$n=1;s/\\*/\"\\\\\" . $n++/ge'<<<" & (quoted form of r))}
    end escapeForSED
    For what you want to do, you must have the wildcard in the same position in both string. --> find "Table 1::$*$3", replace "Table 1::$*$4"
    Important, you can use no wildcard in both (the search string and the replacement string) or you can use any wildcard in the search string with no wildcard in the replacement string).
    But, the number of wildcard in the replacement string must be equal or less than the number of wildcard in the search string.

  • Replacing a part of a String with a new String

    Hi everybody,
    is there a option or a method to replace a part of a String with a String???
    I only found the method "replace", but with this method I only can replace a char of the String. I don't need to replace only a char of a String, I have to replace a part of a String.
    e.g.:
    String str = "Hello you nice world!";
    str.replace("nice","wonderfull");   // this won't work, because I can't replace a String with the method "replace"
                                        // with this method I'm only able to replace charsDoes anyone know some method like I need???
    Thanks for your time on answering my question!!
    king regards
    IceCube-D

    do check java 1.4 api, I think there is a method in it, however for jdk1.3 you can use
    private static String replace(String str, String word,String word2) {
         if(str==null || word==null || word2 == null ||
               word.equals("") || word2.equals("") || str.equals("")) {
              return str;
         StringBuffer buff = new StringBuffer(str);
         int lastPosition = 0;
         while(lastPosition>-1) {
              int startIndex = str.indexOf(word,lastPosition);
              if(startIndex==-1) {
                   break;
              int len = word.length();
              buff.delete(startIndex,startIndex+len);
              char[] charArray = word2.toCharArray();
              buff.insert(startIndex,charArray);
              str = buff.toString();
              int len2 = startIndex+word2.length();
              lastPosition = str.indexOf(word,len2);
         return buff.toString();

  • How to used REGEXP_REPLACE  for replace part of string ?

    hi
    How can i replace part of string as following , i want to replace space in date by "-"
    SELECT
    REGEXP_REPLACE(upper('Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012'),
    '[0-9]{1,2}[^0-9](JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC)[^0-9][0-9]{4}',
    ' ','-') "REGEXP_REPLACE"
    FROM DUAL;
    the output will be like this
    Daivd bought stuff by 2000 USD on 12-Sep-2012 from KL and left kl on 20-Sep-2012
    regards

    I thought the questions is answered.
    Your code will not work, because the alternate expression applies only to the four digit year and the month.
    If you want to recognize both date formats with one expressions, you have to group the complete expressions.
    The disadvantage of this would be, that the backreferences would not work in the same way because you would have more groups.
    I advice to use two separate regular expressions for this task.
    Take a look at the following example if you simply want to fill the gaps with -:
    with yourtable as
      select 'Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012' text from dual union all
      select 'Daivd bought stuff by 2000 USD on Sep, 20 2012 from KL and left kl on Sep, 20 2012' text from dual 
    SELECT
    REGEXP_REPLACE(
    REGEXP_REPLACE(text,
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})','\1-\2-\3',1,0,'i'),
    '(JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC), ([0-9]{1,2}) ([0-9]{4})','\1-\2-\3',1,0,'i') regexp_replace
    FROM yourtable;If you want same output-format for both date formats you could use this:
    with yourtable as
      select 'Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012' text from dual union all
      select 'Daivd bought stuff by 2000 USD on Sep, 20 2012 from KL and left kl on Sep, 20 2012' text from dual 
    SELECT
    REGEXP_REPLACE(
    REGEXP_REPLACE(text,
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})','\1-\2-\3',1,0,'i'),
    '(JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC), ([0-9]{1,2}) ([0-9]{4})','\2-\1-\3',1,0,'i') regexp_replace
    FROM yourtable;Edited by: hm on 25.09.2012 22:00

  • REPLACE part of string

    Hi.
    I have a string column in a DB where it's values contain the following midway through the string ([DOCUMENTGUID] is a uniqueidentifier that is different for each row):
    <a href="../downloadDoc.aspx?dg=[DOCUMENTGUID]" target="_blank">
    I would like to replace this part of the string with a different piece of text.
    I know that I should be using PATINDEX and REPLACE functions but I don't know how to utilise.
    How can I go about this please?
    Thanks in advance.

    Assuming the string you gave is consistent you can use this
    SELECT STUFF(YourColumn,PATINDEX('%<a href="../downloadDoc.aspx?dg=%',YourCol),PATINDEX('%target="_blank">%',YourCol)- PATINDEX('%<a href="../downloadDoc.aspx?dg=%',YourCol) +1 ,'<your new text')
    FROM table
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Find and replace value in Delimited String

    Hi All,
    I have a requirement, where i need to find and replace values in delimited string.
    For example, the string is "GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~". The 4th column gives month and year. I need to replace it with previous month name. For example: "GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~". I need to do same for last 12 months.
    I thought of first devide the values and store it in variable and then after replacing it with required value, join it back.
    I just wanted to know if there is any better way to do it?

    for example (Assumption: the abbreviated month is the first occurance of 3 consecutive alphabetic charachters)
    with testdata as (
    select 'GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~' str from dual
    select
    str
    ,regexp_substr(str, '[[:alpha:]]{3}') part
    ,to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY') part_date
    ,replace (str
             ,regexp_substr(str, '[[:alpha:]]{3}')
             ,to_char(add_months(to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY'),-1),'MON')
    ) res
    from testdata
    STR
    PART
    PART_DATE
    RES
    GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~
    FEB
    02/01/2013
    GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
    with year included
    with testdata as (
    select 'GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~' str from dual
    select
    str
    ,regexp_substr(str, '[[:alpha:]]{3}-\d{2}') part
    ,to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY') part_date
    ,replace (str
             ,regexp_substr(str, '[[:alpha:]]{3}-\d{2}')
             ,to_char(add_months(to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY'),-1),'MON-YY')
    ) res
    from testdata
    STR
    PART
    PART_DATE
    RES
    GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
    JAN-13
    01/01/2013
    GL~1001~157747~DEC-12~CREDIT~A~N~USD~NULL~
    Message was edited by: chris227 year included

  • Get a part of the string

    Hi SAP gurus 
    i have a string where i need to eliminate 'A.B.N' from the following string please advice
    as i am new to xslt i am not sure how
    xsl:value-of select="concat('A.B.N. ',$vABNNameValue)"/
    this is the part of the xsl i am trying to change the above statement in .
    :for-each select="/ORDERS02/IDOC/E1EDKA1" >
                                        <xsl:if test="PARVW = 'LF' ">
                                            <Name3>
                                                <xsl:variable name= "vABNNameValue">
                                                     <xsl:value-of select="''" />
                                                     <xsl:for-each select="E1EDKA3" >
                                                        < xsl:if test="QUALP = 'ABN' ">
                                                            <xsl:if test="STDPN != ''">
                                                                 <xsl:value-of select= "STDPN"/>
                                                             </xsl:if>
                                                         </xsl:if>
                                                     </xsl:for-each>
                                                 </xsl:variable>
                                                 <xsl:choose>
                                                     <xsl:when test= "$vABNNameValue != ''">
                                                        < !xsl:value-of select="concat('A.B.N. ',$vABNNameValue)"/-!>
                                                        <xsl:value-of select="concat(' A.B.N. ',$vABNNameValue)"/>
                                                        <!<xsl:value-of select="$vABNvalue"/>>
                                                    </xsl:when >
                                                    <xsl:otherwise >
                                                        <!-- OVSD Call 324728 End -- >
                                                        < xsl:variable name="Name3Test">
                                                            <xsl:call-template name="Template_GetE1EDKA1Name3">
                                                                 <xsl:with-param name= "TestValue">LF</xsl:with-param >
                                                            < /xsl:call-template>
                                                        < /xsl:variable>
                                                        < xsl:if test="$Name3Test != ''" >
                                                            <xsl:value-of select="$Name3Test"/ >
                                                        </xsl:if >
                                                        <!-- OVSD Call 324728 Begin -- >
                                                    < /xsl:otherwise>
                                                < /xsl:choose>
                                            < /Name3>
                                        < /xsl:if>
                                    < /xsl:for-eac
    please advice its so urgent i have a production issue
    i know there is a function substring
    thanks

    Have a look at this
    http://www.w3schools.com/xpath/xpath_functions.asp#string
    i guess this might be useful to you :
    <b>replace(string,pattern,replace)       </b>
    Returns a string that is created by replacing the given pattern with the replace argument
    Example: replace("Bella Italia", "l", "")
    Result: 'Bea Itaia'
    in your case
    <b>replace("someA.B.Nssss","A.B.N","")</b>
    I think it would work. try this....
    PS: award points if answer helps you.
    thanks,
    Pooja

  • T400 case number and replacement part?

    I have a clients T400 that has come out of warranty. His 160GB HD died. I called Lenovo first to make sure the machine was out of warranty, the tech advise me that is way and gave me the HD FRU number and the phone number to call to get a replacement.
    My colleague called IBM and gave them the part number, they said the FRU doesn't exsist and got us the correct part number but said unless we had a case number from Lenovo the drive would be sold AS-IS. So if we bought it and for someone reason it didn't work they would not warranty or exchange the drive.
    So my colleague called Lenovo back who said "We don't give case numbers out for machines out of warranty". It seems that IBM thinks differently. Lenovo also said there some way of creating a case on their website which will send me an email with the correct replacement part number...do you think I could find what they are talking about??? NO!
    Has anyone had to deal this mayhem? It's like the left hand doesn't know what the right hand is doing....Plus it makes not sense to not properly help people who have OOW machines that are still fairly new.
    I have thought of maybe getting the one of the big bosses at IBM on the phone to fight it out with the boss at Lenovo!
    Andrew
    Xbase Technologies Corp.

    hey xbasetech,
    could you pm to me the following and i will see what i can do for you :
    Name:
    Country:
    Mobile:
    Email:
    MTM [machine type model]:
    (To locate MTM - http://support.lenovo.com/en_US/FindProductNumber.page#find)
    S/N:
    Date of Purchase:
    Case/Order Number : (if any)
    Screenshot of Error(if applicable) : (upload it to a hosting site and paste the link here)
    Location of unit : Home / Repair Center (delete where appropriate)
    Description of issue :
    WW Social Media
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    Have you checked out the Community Knowledgebase yet?!
    How to send a private message? --> Check out this article.

  • Converting part of the string to a date and subtract with sysdate.

    HINT! In order solve this you must know how the pnr is assembled. Study this:
    650323-5510, we only need the first six characters. They inform us about when the person (car owner) was born. In this case it is 23 Mars 1965. You have to use several oracle built-in-functions to solve this. Hint! Begin by converting part of the string to a date and subtract with sysdate.
    select to_char(to_date(cast(pnr,'YYMMDDMM'))) from car_owner;
    please what am i doing wrong. i need the result to be something like this
    Hans, Rosenboll, 59,6 years.

    Hi.
    The main problem here is you have only last two digits of year. That could be the problem in a couple of years from now, when somebody born after 2k would get in to your database. For now if we ignore this problem the right solution would be :
    <code>
    SELECT months_between(trunc(SYSDATE),
    to_date('19' || substr('650323-5510',
    1,
    6),
    'YYYYMMDD')) / 12 years_old
    FROM dual
    </code>
    Suppose you are expecting the age of the car owner as a result above code will give you that. One again notice the '19' I appended.
    Best regards.

  • HP pavilion Dv6 Fan Problem - Want to know replacement part number

    Hi,
    I purchased HP Pavilion dv6t QE in Dec 2011. Just after the warranty expired in Dec 2012 its fan stopped working. Whenever I am starting laptop I am getting error that laptop fan is not working correctly. I am ready to get the fan/heat sink changed but I am not able to find the replacement part on HP website. Please let me know the HP Fan & Heat Sink replacement number for below model:
    Serial : 2CE14903X3
    Product: QJ912AV
    Model - dv6t-6b00
    This question was solved.
    View Solution.

    Hi:
    Below is the link to the service manual for your notebook.
    http://h10032.www1.hp.com/ctg/Manual/c03015537.pdf
    The available fan/heatsink combos with HP part numbers can be found in chapter 3, on page 27.
    In order to get the right one you need to know what hardware is installed in your PC.
    Since it is a CTO (configured to order), there are no product specs available.
    So it is incumbent upon you to know for example if your notebook has an Intel processor and a graphics
    subsystem with 2048-MB discrete memory.
    Once you determine the right part number you need, you can order it online at the link below.
    http://h20141.www2.hp.com/Hpparts/Default.aspx?mscssid=2DE434CEF5B743168A44405770DB2EA5
    If you want a second opinion on if you are choosing the right part, I will be happy to help once you describe the specs for your PC.

  • Replacement part number for (MCS7828I4-K9-BE7)

    hi everyone,
    i want to configure the mcs server (MCS7828I4-K9-BE7) on the dynamic configuration tool but it's showing me error. i guess this should be end of life/end of sales.
    what is the replacement part number for this please(MCS7828I4-K9-BE7)..thankssamson

    Hi Samson,
    This has been announced as EoL as you nicely noted, but it should be available
    via Cisco until October 6
    End-of-Life Announcement Date
    The date the document that announces the end of sale and end of life of a product is distributed to the general public. April 7, 2010
    End-of-Sale Date
    The last date to order the product through Cisco point-of-sale mechanisms. The product is no longer for sale after this date.    October 6, 2010
    Replacement;
    MCS7828I4-K9-BE7
    Unified CM BE 7.X, 7828-I4 appliance, 50 seats
    MCS7828I4-K9-BE8
    Unified CM BE 8.X, 7828-I4 appliance, 50 seats
    End-of-Sale and End-of-Life Announcement for the Cisco Unified Communications Manager Business Edition 7.1
    http://www.cisco.com/en/US/prod/collateral/voicesw/ps6788/vcallcon/ps556/end_of_life_notice_c51-597146.html
    Cheers!
    Rob

  • Where can i get a replacement part of  the wireless keyboard A1314

    I wonder if I  can  get some replacement part (capss lock keys) of the wireless keyboard at any apple store??

    Call the Apple store and find out.
    Barry

  • Where can i buy original iPhone 5 replacement parts?

    Where can i buy original iPhone 5 replacement parts, like: iphone 5 back housing (black&slate)

    Can i order them online? Because there are many sites that sell :
    OEM Apple iPhone 5 Rear Housing ,Black, With Words
    My Rear Housing is damaged and here in Albania we don't have Apple Authorized Service Providers. Do you know for example how much does a Rear Housing cost?
    Thank you

Maybe you are looking for

  • Thanks to Oracle team for great Christmas gift ! (pb on Webcenter link)

    Hi, You are very great to give us TP3 for our Christmas gift ! I've noticed a link problem on this page : http://www.oracle.com/technology/software/products/jdev/htdocs/11techpreview.html => This link for WebCenter is broken : Oracle WebCenter 11g Te

  • Options for file conversion

    Hello, I'm having difficulty putting old presets (CS5.5), the new version (CS6). I downloaded the trial version, but only came fourth file conversion options, among them F4V, FLV, H.264 and MP3. Where did all the other options (MPG, AIFF, M2V and man

  • Why does my iMAC 2011 shutting down intermittently?

    It will only restart after I turn the power source off & then on.

  • PSE8 crashes when clicking on a video

    All was well until I installed Premier Elements 8.0 today. Now when I load PSE8's organizer and single-click on a video's thumbnail, PSE8 crashes. What now? I've updated my graphics driver and completed all the steps that were suggested at Premier El

  • How do I re-synchronize video with its audio in PPCS5?

    I've captured video recorded at 24/fs.  PPCS5 captured the video and audio.  The video and audio play at dis-similar rates in PPCS5. The video and audio are synchronized when played in Windows Media Player, Real Player, and Corel. Appreciate a fix. A