How can i remove text in between the tags

Hi 
I want to remove the text inside the xml tags and am failing to do so. i have tried this codding with no results.
<value>yes</value> = <value></value>
<value>yes</value> = <value></value>
<value>yes</value> = <value></value>
my code:
                string text = File.ReadAllText(outputFilePath);
                text = DeleteBetween1(text,"<value>", "</value>");
 public string DeleteBetween(string STR, string FirstString, string LastString)
            string regularExpressionPattern1 = @"(?:\" + FirstString + @")(<^<>+)\<\/" + LastString;
            Regex regex = new Regex(regularExpressionPattern1, RegexOptions.Singleline);
            MatchCollection collection = regex.Matches(STR.ToString());
            var val = string.Empty;
            foreach (Match m in collection)
                val = m.Groups[1].Value;
                STR = STR.Replace(val, "");
            return STR;

hi,
you can try below.
https://social.msdn.microsoft.com/Forums/en-US/b9b4d8d6-38ba-4483-abfd-4939aca0593d/how-can-i-extract-text-string-between-two-tags-?forum=csharpgeneral
hope that helps.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Similar Messages

  • How can I remove all content between two tags using Find/Replace regular expressions?

    This one is driving me bonkers...  I'm relatively new to regular expressions, but I'm trying to get Dreamweaver to remove all content between two tags in an XML document.  For example, let's say I have the following XML:
    <custom>
    <![CDATA[<p>Some text</p>
    <p>Some more text</p>]]>
    </custom>
    I'd like to do a Find/Replace that produces:
    <custom>
    </custom>
    In essence, I'd like to strip all of the content between two tags.  Ideally, I'd like to know how to strip the CDATA content as well, to return the following:
    <custom>
    <![CDATA[]]>
    </custom>
    I'd much appreciate any suggestions on accomplishing this.
    Many thanks!

    Thanks much for your response.  I found David's article to be a little thin with respect to examples using quantifiers in coordination with the wildcard metacharacters; however, I was able to cobble together a working expression through trial and error using the information he presented.  For posterity, here’s the solution:
    Find:
    <custom>[\d\D]*?</custom>
    Replace:
    <custom>
    <![CDATA[]]>
    </custom>
    I believe this literally translates to:
    [] = find anything in this range/character class
    \d = find any digit character (i.e. any number)
    \D = find any non-digit character (i.e. anything except numbers)
    *? = match zero or more times, but as few times as possible (i.e. match multiple characters per instance, but only match one instance at a time, or none at all)
    I’m still not sure how to effectively utilize the . wildcard.  For example, the following expression will not find content that ends with a number:
    <custom>.*?[\D]*?</ custom >
    I'm presuming this is because numbers aren't included in the \D metacharacter; however, shouldn't numbers be picked up by the .*? expression?

  • HT5622 We have two iphones with the same Apple ID. Since I installed iOS this morning I have started receiving all my sons texts and when I send him a text it is delivered to both of us. How can I remove my phone from the joint Apple ID and remove myself

    My son and I both have iphones with the same Apple ID. Since I installed iOS this morning I have started receiving all my sons texts and when I send him a text it is delivered to both of us. How can I remove my phone from the joint Apple ID and remove myself from finding out what he is up to during Freshers week!

    You have to use a different Apple ID for your son.
    Read this note:
    iOS 5 & iCloud Tips: Sharing an Apple ID With Your Family
    still valid for ios 7

  • How can i use text expander with the new Mavericks,

    how can i use text expander with the new Mavericks,

    I regret upgrading to mavericks for the same reason
    ftamez wrote:
    how can i use text expander with the new Mavericks,
    Now I have been searching - and you have to buy an app and it will cost you $34.99 (what a rip off)

  • How can I remove multiple copies of the same song from the iTunes listing?

    How can I remove multiple copies of the same song from the iTunes listing. The program seems to be picking up the same songs from, for example, my user area and my public area in the C drive

    As above, Apple's official advice is here... HT2905 - How to find and remove duplicate items in your iTunes library, however it is a manual process and the article fails to explain some of the potential pitfalls.
    Use Shift > View > Show Exact Duplicate Items to display duplicates as this is normally a more useful selection. You need to manually select all but one of each group to remove. Sorting the list by Date Added may make it easier to select the appropriate tracks, however this works best when performed immediately after the dupes have been created.  If you have multiple entries in iTunes connected to the same file on the hard drive then don't send to the recycle bin.
    Use my DeDuper script if you're not sure, don't want to do it by hand, or want to preserve/merge ratings, play counts and playlist membership. See this thread for background and please take note of the warning to backup your library before deduping.
    (If you don't see the menu bar press ALT to show it temporarily or CTRL+B to keep it displayed)
    tt2

  • How can i remove favourite people from the top of my iPhone !

    how can i remove favourite people from the top of my iPhone !

    Hey donyh1,
    Thanks for the question. You can hide the recent contacts in the multitasking screen by navigating to your Contacts settings:
    Contacts settings - iPhone
    http://help.apple.com/iphone/8/#/iph96b20610
    Thanks,
    Matt M.

  • I'm new to Photoshop Elements and just getting started.  While in the organizer I have one group of photos up to learn with and now it says Edit in Progress with a padlock icon.  How can I remove this so that the photos will be restored to normal?

    I'm new to Photoshop Elements and just getting started.  While in the organizer I have one group of photos up to learn with and now it says Edit in Progress with a padlock icon.  How can I remove this so that the photos will be restored to normal?

    Go back to the editor and close the photo there.

  • How can i remove secure files from the trash? I tried click away the secure notification in info, but still i cann't remove them. Is there a buttoncombination to use?

    How can i remove secure files from the trash? I tried click away the secure notification in info, but still i cann't remove them. Is there a buttoncombination to use?

    If you are unable to empty the trash, try holding the Option key while selecting Empty Trash.
    Otherwise, some steps in the following link may help you.
    http://support.apple.com/kb/ht1526

  • How can I remove Personal Hotspot for the iPad

    How can I remove Personal Hotspot for the iPad, I use apple configurator but I still can NOT do it. any idea?

    I mean hide it, or remove it or delete it. I just don't wanna anyone on my enterprises use it because my data plan gonna be high cost.
    supported by my carrier, I asked my carrier if they can remove it ? they said they can NOT.

  • HT201371 How can I remove touch ID when the handset is turned off?

    How can I remove touch ID when the handset is turned off?

    Off it off. The only thing you can do when the phone is off is turn it on either by plugging it into power or by pressing the power button...
    Please rephrase the question.

  • How can I remove all returns within the text?

    I copied and pasted text onto pages from the internet, but the text does not go all the way to the end of the set margins that i have on Pages, instead it goes about halfway or so and begins on a new line. how can i remove all of the spaces between the words so that it runs the full length of the page.
    It blows my mind that i have to resort to seeking help on the apple forums for this problem, it seems like something so simple would be a standard feature when adjusting text on the page. The only thing that could frustrate me more is if it impossible to do on this software, or if it is simple to do and I was too stupid to figure it out. If it is impossible then I'm **** out of luck because the document is just to **** long to sit there for hours and manually delete every single last return.

    Not to preempt your fun of playing with AppleScript, but here's my take on it:
    tell application "Pages"
        tell document 1
            -- Make sure there's no selection
            select insertion point before character 1
            set cc to count characters of body text
            set returnOffsets to (character offset of every character where it is return)
            -- Reverse order, since deletion would alter all subsequent offsets
            repeat with n in reverse of returnOffsets
                if (n > 1) then
                    if n < cc and character (n + 1) is return then
                        -- Treat double returns as a true paragraph break.
                        -- Delete the extra.
                        delete character n
                    else if character (n - 1) ≠ return then
                        -- Change single returns into spaces.
                        set character n to " "
                    end if
                end if
            end repeat
        end tell
    end tell

  • TS1424 How can I remove. Download from the quere

    I recently have been purchasing a few episodes of the office every couple of days... 26 episodes in the season and by the time I got to 15 episodes it said I only owed 2.00 to get reminder of season. I ordered every episode in standard but when I went to download rest of season it deleted all my standard versions and replaced with hd... Now the hd are too big to fit every episode on my iPad and I just want to get them all in standard... iPad won't let me download in standard until the hd versions complete downloading... Takes bout a hour per episode to download... How can I remove the hd episodes from my queer so I can redownload in sd.

    Did you hold the Command (Apple) key while dragging them off the sidebar? That usually makes them go *poof*.

  • How can you remove old conversations from the iMac. Even when I remove them they return when I start a new conversation with the same person. Only happens on iMac with the Beta iMessage program

    How do you remove an old conversation using  the Beta iMessage on an iMac. When I open a new conversation with the same person the old conversation comes back

    Hi,
    Previously iChat had tried a Last Chat/IM option when using Saved Transcripts - which itself was an option.
    iChat has also tried "Saving" the Last Chat by leaving a Chat window open and using something similar to the Lion method of showing an app in the state is was closed in.
    In Messages the option to Save Transcripts has been removed and Chats or all types are saved as a matter of course.
    What this tends to mean for your iChat style Buddy Chats is that it opens all the Transcripts  for that buddy as a sort of History you can scroll back through if you want  (I have  some Buddies with saved chats gong back to 2004)
    With the Syncing of iMessages with iPhones and iPads (or Touches) then it seems this works slightly differently.
    Although you can delete the chat and the contents of the Chat as separate action it is true that in the Beta as soon as you connect to the same Contact that the contents of the previous chats are shown to you.
    I have found that Messages stores a data base of info on iMessages in Your Home Folder/Library/Messages
    I have found that deleting this chat-db removes the "History" that keep popping up.
    By default the Saved "iChats" are also stored in the Home Folder/Documents/iChats (At least this is the default place iChat used and they go to the same iChats folder where ever you had it)
    Some people claim removing iMessages saved here stops the "History" reappearing.
    In Lion the only access to the Home Folder/Library is via the Finder's Go Menu and hiding down the ALT key
    10:00 PM      Sunday; June 10, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.4)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.7.4),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How can I remove a device from the iCloud?

    I upgraded my iPad, replacing the old one, the new one does not sync with iCloud Drive, in other words my iPhone 6 used to sync data with the previous iPad.
    I have already checked the iCloud login and made sure iCloud drive is on on both devices and made sure the app in question is also on on both devices.
    I believe the reason is because now my iCloud account shows two iPads, the old and the new one.
    How can I delete the old iPad from my iCloud account?

    After logging into iCloud, you can select devices, and then remove the old device. Have you gone on the old device and disabled iCloud Drive, or signed out of iCloud on the old iPad. That would be the easiest I believe.

  • How can I link text boxes between different Master Pages in InDesign?

    I want to link text boxes back and forth between different Master Pages in InDesign. How can I do this?

    I'm interested to know what it is you're trying to achieve - can you explain what you want your text to do?
    Regards,
    Malcolm

Maybe you are looking for

  • Bom Component qty & WIP Quantity differ at Trget cost calculation

    Dear gurus, i am facing the problem with WIP at target cost calculation in REM. My issue is BOM Component qantity is 9.524 TO  and price is 2000 then total cost is  9.521*2000=19048. but in WIP Report kkas in WIP explation it takes input qty 9.52 T0

  • Unit of measurement transport translation

    Dear all, i´ve translated the description from the unit of measurement ST. At the beginning in the translation i get a popup, that theres no automatic recording. But how can i create a own transport request or how can i save the translation in a tran

  • HELP !! LED problem

    Hello, my a/c unit recently dropped some water on my 8900 which at first I thought was only on the outside. I dried it off. The next thing it did was refuse to connect to my server. When I opened it, that's when I saw the amount of water inside the p

  • Query regarding certification

    Hi, Is it possible to appear for SAP - Certification exams seperately than through SAP tech-ed ?I am having all the required criteria needed for appearing the certification exams. But,due to some reason,I may not able to be attend the exam during Dec

  • Touch Smart TX 2 DVD Video

    My Wife has a TouchSmart TX2 and recently bought a movie Eat Pray Love. This Computer usually plays DVDs with Media Player without any problem but it refuses to play this new one.  If you insert the DVD it thinks about it for quite a while and then d