find-and-replace

Replacing a line in a file "in place" - C#

Possible Duplicate: Editing a text file in place through C# I need to replace a line in a very big file , so I don't want to readAll and writeAll - I want to get to the line requiring replacement , replace , and close the file. Any idea how to do it in C#? Thanks! ...

php backslash find and replace

I am trying to do a simple find and replace within a string with: $share_name = str_replace(" ", "\ ", $share_name ); Unfortunately for some reason it replaces all the spaces with "\\ " instead of "\ ". Does anybody know whats going on and how to solve this problem? ...

Textual find and replace within an XML column

Hi All, I'm trying to find and replace all instances of 'this phrase' with 'that phrase' in an xml type column using T-SQL. The xml column contains fields that are more than 8000 characters long. I tried using the Replace function but it doesn't like the XML data type, and the data can't be squeezed into a varchar. Phil ...

how to find the difference between a csv file and a file containing only one column of this csv

I have a CSV file containing some user data it looks like this: "10333","","an.10","Kenyata","","Aaron","","","","","","","","","","" "12222","","an.4","Wendy","","Aaron","","","","","","","","","","" "14343","","aaron.5","Nanci","","Aaron","","","","","","","","","","" I also have a file which has an item on each line like this: a...

MySQL query to find and replace a string in field names

Is there a mysql query to find and replace parts of field names? I know you can do that within the actual data using update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]'); ... but how do you do that for the actual field names? I have some fields with a - in the name, and I'd like...

WPF: DataGrid Find and Replace

I'm using a DataGrid to display the values of specific properties of a collection of objects. I've implemented search and cell highlighting through a similar method to the one on Tomer Shamam's blog. However, I now need to implement 'Find/Replace' type functionality. I presumed I would be able to iterate through the DataGrid's cells to ...

Is there a way to find/replace across an entire project in Eclipse?

I'm trying to do a find and replace over many files within an Eclipse project, but I can't seem to find a way to do it. Googling showed me that there are plug-ins that can accomplish this, but is there any built-in functionality in Eclipse? (It seems to be a pretty basic task; it's surprising me that I can't find a way to do it.) ...

Regex to Find/replace argument pattern in a function-call across all files

I have a large codebase, where we need to make a pattern-change in the argument of a specific function. i.e. All arguments to a function foo() are renamed from the format something.anotherThing are to be renamed as something_anotherThing The arguments can be anything but will always be in a str1.str2 format. It is to be done for argume...

Get all occurences of the search pattern

I try to get all occurences of a pattern from a file, but currently I fail if there is more than one occurence per line. Sample line in file: lorem ipsum foo="match1" lorem ipsum foo="match2" lorem ipsum The output I want: match1 match2 I tried getting this using sed: sed -ne 's/^.*foo="\([^"]*\)".*$/\1/p' With this expression ...

What is the regular Expression to uncomment a block of Perl code in Eclipse?

I need a regular expression to uncomment a block of Perl code, commented with # in each line. As of now, my find expression in the Eclipse IDE is (^#(.*$\R)+) which matches the commented block, but if I give $2 as the replace expression, it only prints the last matched line. How do I remove the # while replacing? For example, I need to...

jQuery - Change part of contents in form

Just starting out with jQuery and this problem seems to be impossible to me. Search all the forums, no luck. Maybe you guys can help me? My html looks kinda like this: <form> <table class="tableClassName"> [content] </table> <div class="divClassName"> [content] </div> Here is some text <div class="divClassNam...

find-and-replace placeholder characters with sequential numbers

I need to convert about 5,000 subtitles from a proprietary format to SRT format. Doing so involves numbering each subtitle. I can easily use TextWrangler's Find & Replace to prepend each subtitle with an asterisks or some other placeholder, but what's the easiest way to convert those asterisk (or whatever I use as a placeholder) into s...

Regular Expression in Visual Studio Find & Replace - multiple spaces between search terms

I require a regular expression for the Visual Studio Search and Replace funtionality, as follows: Search for the following term: sectorkey in ( There could be multiple spaces between each of the above 3 search terms, or even multiple line breaks/carriage returns. The search term is looking for SQL statements that have hard-coded Secto...

General substitution over all XML (XSLT)

Basically, what I'm doing right now is running an XSLT, then opening the result in Visual Studio and doing a find and replace for one word - for this example, I want to change all instances of "bar" to "myBar". All instances of "bar" may be assumed to be in text elements like so: <someElement>bar.whatever</someElement> This would be t...

How I match an HTML attribute using Notepad++ regular expression search?

Here is my text: <span class="c1">Testing "this string"</span> and I want to end up with this: <span>Testing "this string"</span> so I tried to use this regex in Notepad++ to replace with nothing: class=".*" but that matches this: class="c1">Testing "this string" How do I stop that match after one instance of "? ...

Substituting values over many XML elements [XSLT 2.0]

Hello everybody, This question is an extension of this one. I have many values, as seen below: <myStuff> <elem1>asdf</elem1> <elem2>foo bar</elem2> <elem3>foo bar foo</elem3> <elem4>foofoo</elem4> </myStuff> I've been doing a copy-of over MOST the elems (the select in the copy-of is very specific) and then doing a fin...

find and replace / refactoring programmatically for files in mac

Hi, I want to make a program that will search and replace some words occurrence in a file. I am using xcode. I want to do this programmatically using some standard free API in a MAC application. ...

Find and Replace with JQuery

I am trying to use JQuery to search and replace all instances of a given string. JQuery was the only method I found which doesn't force-reload the whole page. This is what I have right now: <script> $("*").each(function () { if ($(this).children().length == 0) { $(this).html($(this).html().replace('0101','0102')); } }); ...

Removing non-ascii characters from any given stringtype in Python

>>> teststring = 'aõ' >>> type(teststring) <type 'str'> >>> teststring 'a\xf5' >>> print teststring aõ >>> teststring.decode("ascii", "ignore") u'a' >>> teststring.decode("ascii", "ignore").encode("ascii") 'a' which is what i really wanted it to store internally as i remove non-ascii characters. Why did the decode("ascii give out a uni...

Is there a way to copy the case of a character and impose it on some other character in output?

VS2008 allows you to use regular expressions in the find/replace dialogs. I've run into a couple of moments where I've needed to copy the case of a specific character and impose it on the replace string. For example I have a block of code that has Monday and monday scattered throughout. I want to change each Monday to a Friday as well...