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

Similar Messages

  • 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

  • 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.

  • Two finger swipe replaces google search string

    MBP with Safari 6.0 experiencing this problem.  Another user was experiencing the issue here:
    http://www.ehmac.ca/mac-iphone-ipad-ipod-help-troubleshooting/99937-safari-two-f inger-swipe-bug-replaces-google-search-string-os-10-7-3-a.html
    I don't know where the bug reports are to follow up on it and I haven't seen any patches for it.  Any advice?  Specifically, I'd like to know how to file the bug (in case I find another) and to follow up on any existing issues.
    TIA,
    Scott

    Is there no place to track the status of the report or see any other outstanding issues so I don't bother filing duplicates?
    Never heard of such a function here. This method gets feedback to the people who count but it is completely behind the scenes. Part of Apple's "cards close to the chest" method of doing pretty much everything. You should have been looking at the "don't expect a response" screen after you hit the submit button on your bug report.
    If there is something that needs clarification, I suspect they will use e-mail to ask for it, but don't stay home waiting!
    Have you read Walter Isaacson's  biography of Steve Jobs? Things like this took on a new--if not satisfying--perspective for me after reading it. So far, it has persisted in their corporate culture in the after-Steve era..

  • Replace " from the string

    Hi,  I am not able to remove " (double quotes) from a sting.
    I am using replace function in webi but getting error.
    example sting: Yellow stone"discovery"
    i have tried like this: =replace([varible];""";"")  but getting error. can anybody help me in removing the " from sting.
    Thanks.

    Description
    Replaces part of a string with another string
    Function Group
    Character
    Syntax
    string Replace(string input_string; string string_to_replace; string replace_with)
    EX:=Replace ([[variable]]; Char(34) ;"")
    Input
    input_string                     The input string 
    string_to_replace             The string within input_string to be replaced 
    replace_with                    The string to replace string_to_replace with. 
    Output
    The string with the part replaced
    Example
    Replace ("New YORK";"ORK";"ork") returns "New York"
    All the best,
    Praveen

  • Replace all ', , ' inside string

    i have long string and with pl/sql i want to replace all ', ,' with ', null,'.
    I can use replace function like:
    prepare_insert := replace(prepare_insert,', ,',', null,');
    but it will only replace first ', ,' not all. How can i replace all?

    5th database commandment:
    Thou shalt not create dynamic insert statements!
    I think using bind variables or the using clause in the execute immediate statement would solve the problem.
    But of cause you can do it also the hard (and slow) way.
    The problem is that your search string is not correct. It does include a leading "," and leaving ",". However if the leavaing "," is also the leading "," of the next replacement part then the function can't take this into account.
    Solution 1) Take care of this while building the string in the first place.
    While concating the pieces togeather use NVL(value,'null'). If you are sure that there s no value, then write NULL.
    Solution 2) Use a double replace
    with testdata as (select 'Test, , , , ''ABC''' txt from dual union all
                      select 'Test2, , , ''ABC''' txt from dual
    select txt
          ,replace(replace(txt,', ,',',null,'),', ,',',null,')
    from testdata;
    TXT               REPLACE
    Test, , , , 'ABC'     Test,null,null,null, 'ABC'
    Test2, , , 'ABC'     Test2,null,null, 'ABC'

  • How Can I replace newScale Text Strings with Custom Values?

    How Can I replace newScale Text Strings with Custom Values?
    How can I replace newScale text strings with custom values?
    All  newScale text is customizable. Follow the procedure below to change the  value of any text string that appears in RequestCenter online pages.
    Procedure
    1. Find out the String ID of the text string you would like to overwrite by turning on the String ID display:
    a) Navigate to the RequestCenter.ear/config directory.
    b) Open the newscale.properties file and add the following name-value pair at the end of the file:res.format=2
    c) Save the file.
    d) Repeat steps b and c for the RmiConfig.prop and RequestCenter.prop files.
    e) Stop and restart the RequestCenter service.
    f) Log  in to RequestCenter and browse to the page that has the text you want  to overwrite. In front of the text you will now see the String ID.
    g) Note down the String ID's you want to change.
    2. Navigate to the directory: /RequestCenter.ear/RequestCenter.war/WEB-INF/classes/com/newscale/bfw.
    3. Create the following sub-directory: res/resources
    4. Create the following empty text files in the directory you just created:
    RequestCenter_0.properties
    RequestCenter_1.properties
    RequestCenter_2.properties
    RequestCenter_3.properties
    RequestCenter_4.properties
    RequestCenter_5.properties
    RequestCenter_6.properties
    RequestCenter_7.properties
    5. Add the custom text strings to the appropriate  RequestCenter_<Number>.properties file in the following manner  (name-value pair) StringID=YourCustomTextString
    Example: The StringID for "Available Work" in ServiceManager is 699.
    If you wanted to change "Available Work" to "General Inbox", you  would add the following line to the RequestCenter_0.properties file
         699=General Inbox
    Strings are divided into the following files, based on their numeric ID:
    Strings are divided into the following files, based on their numeric ID:
    String ID  File Name
    0 to 999 -> RequestCenter_0.properties
    1000 to 1999 -> RequestCenter_1.properties
    2000 to 2999 -> RequestCenter_2.properties
    3000 to 3999 -> RequestCenter_3.properties
    4000 to 4999 -> RequestCenter_4.properties
    5000 to 5999 -> RequestCenter_5.properties
    6000 to 6999 -> RequestCenter_6.properties
    7000 to 7999 -> RequestCenter_7.properties
    6. Turn off the String ID display by removing (or commenting out) the line "res.format=2" from the newscale.properties, RequestCenter.prop and RmiConfig.prop files
    7. Restart RequestCenter.
    Your customized text should be displayed.

    I've recently come across this information and it was very helpful in changing some of the inline text.
    However, one place that seemed out of reach with this method was the three main buttons on an "Order" page.  Specifically the "Add & Review Order" button was confusing some of our users.
    Through the use of JavaScript we were able to modify the label of this button.  We placed JS in the footer.html file that changes the value of the butt

  • 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.

  • 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.

  • Replace the connection string in Excel MDS file

    I had MDS solution from one SQL Server 2012 to another - SQL Server 2014. I have configured Excel file with connection to MDS. How can I safely to replace the connection string in my Excel MDS file and the tables is not broken?
    from Moscow with money

    Hi,
    Excel is just used to manage data and create new entities and attributes. Why not first publish and close your excel before MDS upgraded to 2014? After the upgrade, reconnect new solution in your excel.
    thanks,
    Jerry

  • Part of  string

    [email protected]; [email protected],
    if I only want first part of string, I meant before ;
    is that split is the only way to handle this case?

    using split is the easiest way.
    use something like this
    &test = "[email protected];[email protected]";
    &array = Split(&test, ";");
    for &i = 1 to &array.Len
    &email = &array[&i];
    /* Do some processing */
    end-for;
    if you do not want to use split try using the following
    &string = "[email protected];[email protected];[email protected];";
    While Find(";", &string) != 0
    &pos = Find(";", &string);
    &email = Substring(&string, 1, &pos - 1);
    &string = Substring(&string, &pos + 1, Len(&string) - &pos);
    End-While;
    Really, there are a lot of different possibilities of achieving what you want ...
    Edited by: Hakan Biroglu on Jul 10, 2012 4:15 PM

  • 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

  • String function in Oracle 9i to find part of string having two positions

    Hi,
    We need to extract the part of string having start and end position.
    Like
    Suppose the string is "TYPE ref_cur_type IS REF CURSOR" and need to extract name of the ref cursor i.e ref_cur_type.The length of the output is not fixed. But not able to extract the exact string.
    Thanks,

    What is the criteria for part of string? Do you give start character and end character position like 3,9 etc? Or its just that the word that comes between two spaces?
    Cheers
    Sarma.

Maybe you are looking for

  • How do i use my apple id with ichat?

    how do i use my apple id with ichat?

  • Getting a HP Printer "on line"

    I have an 8500 all in one.  I have recently set up a new router.  I have connected the printer to the router.  The printer shows up on the "device" tab when I log into the router.  It is listed as "off line" , so it is "there", but not available. I h

  • One dvd not working?

    i just got a dvd from amazon and when i put it into my disc drive, the dvd player application opened and then quickly 'quit unexpectedly.' i tried reopening the program several times with no success, and when i put in another dvd that i've already wa

  • Java is 100% pure object oriented language or not?

    PLS help me...? I am get confussed. Java is 100% pure object oriented language or not?

  • 0 photos in osx (mac book pro) iPhoto photo stream

    I have six family and friends photo streams on my mac and they all show 0 photos, the same streams on my iPhone have photos in them, what am i doing wrong