replace

String replacing in a file by given position

I have a file opened in 'ab+' mode. What I need to do is replacing some bytes in the file with another string's bytes such that: FILE: thisissomethingasperfectlygood. string: 01234 So, for example, I seek for the position (4, 0) and I want to write 01234 in the place of "issom" in the file. Last appearance would be: this01234eth...

How to change html part of a tag with jquery ?

I have , `<span class="icon">&#9658;</span>` in Jquery I did, $(this).html('&#9660;'); and tried $(this).replaceWith('&#9660;'); too. but it displays '&#9660;' instead of converting it to a html icon like ▼. thanks ...

Replace strings in files by Python

How can you replace the match with the given replacement recursively in a given directory and its subdirectories? Pseudo-code import os import re from os.path import walk for root, dirs, files in os.walk("/home/noa/Desktop/codes"): for name in dirs: re.search("dbname=noa user=noa", "dbname=masi user=masi") ...

MySQL - Search and replace table1.field's contents with contents of table2.otherfield

I need a MySQL query that will do the following: Instead of the alpha team names in the 3rd column of the players table, I want it to reference teams.id table: players id player_name team ------------------------------------------ 1 Sue Smith Silly Chimps 2 Mike Olson Black Cats 3 ...

Can a Regular Expression Replace Expression access multiple captures in a named group?

I'm trying to write a regular expression replace expression that will replace a fully-qualified generic type name with its C# equivalent. For example, the following text: System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[MyNamespace.MyClass, MyAssembly,...

PIL Best Way To Replace Color?

I am trying to remove a certain color from my image however it's not working as well as I'd hoped. I tried to do the same thing as seen here http://stackoverflow.com/questions/765736/using-pil-to-make-all-white-pixels-transparent however the image quality is a bit lossy so it leaves a little ghost of odd colored pixels around where what ...

C# - Count string length and replace each character with another

How can I count the number of characters within a string and create another string with the same number of characters but replace all of them with a single character such as "*"? Thank you. ...

Jquery Update Browser Location, Don't Redirect

I'm building a series of basic accordions for a project. We want them to have static, linkable pages. So we've created invidividual pages for each of the open states as well. For example, /whoweare is the main slider. But we have a sub slider located at /whoweare/whatwedo What I'm looking to have done is, when a user clicks a heade...

SQL replace old values trough new ones

I am trying really hard to solve this problem. I have a table named tbl.Products it has a column named articlenumber which is full of numbers like s401, s402 etc. etc. Now I generated a list with new article numbers which will replace the old ones. It looks like this. s401 I00010 s402 I00020 s403 I00030 s403 I00040 ... I ...

How to replace multiple different chars with white space?

How to replace different/multiple chars with white space for each instance of character? characters to be replaced are \ / : * ? < > | ...

SQL Server replace, remove all after certain character

My data looks like ID MyText 1 some text; some more text 2 text again; even more text How can I update MyText to drop everything after the semi-colon and including the semi colon, so I'm left with the following: ID MyText 1 some text 2 text again I've looked at SQL Server Replace, but can't think of a viable w...

Can MySQL replace multiple characters?

I'm trying to replace a bunch of characters in a MySQL field. I know the REPLACE function but that only replaces one string at a time. I can't see any appropriate functions in the manual. Can I replace or delete multiple strings at once? For example I need to replace spaces with dashes and remove other punctuation. ...

sIFR 3 - does getReplacementByFlashElement() or replaceText() work in IE6?

I'm currently running a Windows XP Pro VM using VirtualBox with IE6 standalone on it for testing purposes. I have noticed that neither of the text replacement methods appear to be working in IE6, however Safari/FF both handle things fine. I would like to know if this issue is pertinent to IE6 in general or am I just suffering from the ...

Ajax replace instead of append

I used the following jQuery example which works like a charm. However it appends the results. What do I need to change to replace the results instead of appending? ...

find, replace and escape string linux

I'm trying find all instances of a string and replace them, the original string looks like this: <li><a href="#" onclick="alert('soon!');">Some Text Here</a></li> the replacement looks like this: <li><a href="<?php print $somevar;?>/some.php">Something new</a></li> What would be a good way to do this in the CLI Thanks ...

Javascript regex

Hi all, Currently I have a basic regex in javascript for replacing all whitespace in a string with a semi colon. Some of the characters within the string contain quotes. Ideally I would like to replace white space with a semi colon with the exception of whitespace within quotes. var stringin = "\"james johnson\" joe \"wendy john...

/ in vi Search and replace?

in vi, search and replace, how do you escape a '/' (forward slash) so that it is correct. Say in a path. like: /Users/tom/documents/pdfs/ :%s//Users/tom/documents/pdfs//<new text>/g --FAILS (obviously) :%s/\/Users/tom/documents/pdfs\//<new text>/g -- FAILS with a trailing error :%s/'/Users/tom/documents/pdfs/'/<new text>/g -- FAILS ...

sed regex to non-greedy replace?

I am aware of another question that is quite similar, but for some reason I'm still having problems. I have a GC log that I'm trying to trim out the Tenured section enclosed in []. 63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs] I...

SQL, remove appearances of a comma at end of the line.

My data looks as follows MyText ------- some text, some more text, even more text,, some text,,,, some text, some text,,, some text, some more text, even more, yet more, and again I would like to achieve: MyText ------- some text, some more text, even more text some text some text, some text some text, some more text, even more, yet ...

Extract float from text line with sed?

I am issuing a sed replace on a line, trying to extract a particular floating-point value, but all that appears to be matched is the right-side of the decimal Text Line: 63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs] If I issue s...