replace

replace cell values within excel using excel.interop

I want to scan an excel sheet, and replace any occurrences of social security numbers with zeros... I would like to do this using Excel.Interop if at all possible, but I'm open to anything at this point... here's some of my code... I'm banging my head on the desk for the past few months... // Get range and convert it to a string varia...

jQuery get text with wildcard contents after an element and move it

Hey, I think this might be a tricky one, but if anyone can solve it I'd be very impressed, and also very grateful. Here's the existing markup (which I can't change, otherwise then it'd be an easy problem and I could solve it myself!): <a title="1 topics" href="http://localhost/tags/amis/"&gt;amis&lt;/a&gt; (1) <a title="2 topics" hre...

Replace broken encoding

Is there a way in Zend Studio (6/7)/Eclipse to replace all broken characters, when you've accidentally saved a file with the wrong encoding? ...

How to add or replace a query string parameter in classic ASP?

I have a set of links in header.asp which is included on every page; these links have their href attribute set to whatever the current page is plus a linkID param. Sometimes the page the link references will have query string params, but other times it won't. If the current page URL contains the linkID param already I need to replace it,...

C# String replace with dictionary

I have a string on which I need to do some replacements. I have a Dictionary<string, string> where I have search-replace pairs defined. I have created following extension methods to perform this operation: public static string Replace(this string str, Dictionary<string, string> dict) { StringBuilder sb = new StringBuilder(str); ...

Replace selected code from eclipse editor thru plugin comand

How do I replace the selected section of code (selected by mouse selection) in eclipse editor and replace it with the same code only in /* selected text / through a plugin? I have already designed a plugin to create a button in the toolbar. When I click it, I need it to change the text that is selected and put it into / */ ...

How do I replace a character in a string in Java?

Using Java, I want to go through the lines of a text and replace all ampersand symbols (&) with the XML entity reference &amp;. I scan the lines of the text and then each word in the text with the Scanner class. Then I use the CharacterIterator to iterate over each characters of the word. However, how can I replace the character? Firs...

html and swf swapping (display html while swf file loads to 100%)

This is what I want to achieve. While the swf file is loading, wrapper div displays an html content (e.g. text content). When the swf file has loaded 100%, it replaces the text content within the wrapper div, and then plays within the wrapper div. When the swf file is finished playing, it is then replaced with the previous text content...

PHP replace question

Hi. I'm using file_get_contents to get a certain files contents. So far that is working. But then i would want to search the file and replace all <a href=" with <a href="site.php?url= before showing the file. How can i do this? I know i should use some kind of str_replace or even preg_replace. But I don't know how to actually search and...

t-sql replacing double quotes

I have a t-sql statement like Replace(field,'\''','\"') because i have two different results ''field1'' and "field2" but what if i consider those two different results the same and want to group them. I choose to group those two by replacing the first double quotes with the second style but although replaced they are not interpreted as ...

PHP search for <link> tag and prepend

Hi! I'm using this code to prepend the url variabel inside the src tag for images. Now i would want an regex code that makes it possible to search for tags and add the url variabel inside the link tags href attribute. This code i have for the images, it might give u hints. function imgprepend_proxy($matches2) { $url = (substr($_GET[...

Changing node id by replacing the node

I am trying to polish off a nav menu by having a script that fetches the current page name (via $_SERVER["PHP_SELF"]) and then in JavaScript finds the relevant name (i.e. from /contact.php finds just contact) and searches for an element with that id (my list items have ids that match their target). Now I want to swap the id of the eleme...

Flex String replace regex problem

I'm hoping someone can see the problem in the following Regex replace example done using Flex: remainder=inputString.replace( "\\("+bracketContents+"\\)(\\s)*(and|or)*(\\s|$)+", ""); For the following example: Input: "a and (e or f)" the normal regex expression given above would be: \(e or f\)(\s)*(and|or)*((\s)+|$)+ ...

Windows Batch Search and Replace Question

I have a small batch file to search and replace within a batch file. I am having difficulty removing things (eg replacing some text with a null value). Am sure it is simple but not found anything by searching! This is the file: Where you see xxxxx and yyyyy is where I need a blank! Cheers. @echo off setlocal enabledelayedexpansion ...

How to replace multiple strings with replace() in Javascript

Hey Guys, I'm guessing this is a simple problem, but I'm just learning... I have this: var location = (jQuery.url.attr("host"))+(jQuery.url.attr("path")); locationClean = location.replace('/',' '); locationArray = locationClean.split(" "); console.log(location); console.log(locationClean); console.log(locationArray); And here is w...

Replacing keywords in a PHP script file using PHP

I have a PHP file with a mix of html, text and php includes name areaname-house.php. The text/html parts of the file contain the String "areaname" in various places. On the other hand I have an array of Strings with city names. I need a PHP script which can take each string (from strings array), copy the areaname-house.php and create a ...

Replacing charset with preg_replace [php]

Hi, i have different websites content stored in a variabel named $content. Now what i would want to do is to search the content for META-tags like this: <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> And then replace the utf-8 to IS0-8859-1. How do i do that with preg_replace? Note that every occurence is not l...

Notepad++ Delete Lines with Find & Replace

Does anyone know how to delete a line using Find & Replace in Notepad++ ? In my Find query it finds the proper lines okay: ^.pPrev.$ In the Replace field, I leave it blank thinking the line should deleted (i.e. replaced with nothing), but the newline and endline characters remain. ...

Changing node name of xml-node with Java

Hey, I have following scenario: I have a XML-Document, e.g. like this <someRootElement> <tag1> <tag2 someKey=someValue someKey2=someValue2 /> <tag3/> <tag4 newKey=newValue newKey2=newValue2 /> </tag1> </someRootElement> Now I want the parent tag1 to be called reallyCoolTag without ...

Java regex to match all html elements except one special case

I have a string with some markup which looks like this: The quick brown <a href="www.fox.org">fox</a> jumped over the lazy <a href="entry://id=6000009">dog</a> <img src="dog.png" />. I'm trying to strip away everything except the anchor elements with "entry://id=" inside. Thus the desired output from the above example would be: The qu...