UPDATE table_name SET column = REPLACE(column, 'old_text', 'new_text');
Tag Archive for replace
MySQL Mass Text/String Replace
Image Replace for Buttons
#submitButton {
width: 38px;/* Width of button image */
height: 19px;/* Height of button image */
padding: 30px 0 0;
margin: 0;
border: 0;
background: transparent url(images/buttonimage.gif) no-repeat;
overflow: hidden;
cursor: pointer; /* hand-shaped cursor */
cursor: hand; /* for IE 5.x */
}
Regular expressions filename replace
// This will strip out any punctuation and spaces from filenames, replacing such characters with underscores
$filename = preg_replace("/[^a-zA-Z0-9s.]/", "_", $filename);
str_replace
function str_replace( search, replace, string ):String{
var array = string.split(search);
return array.join(replace);
}
Search and replace text in a string
var newText:String = "The rain in Spain falls mainly on the plain";
var splitText:Array = newText.split("Spain");
newText = splitText.join("Barcelona");
// outputs "The rain in Barcelona falls mainly on the plain"
search and replace across multiple files with Perl
#print the result of search-and-replace to the terminal
perl -pe 's/bart/milhouse/g' test.html
#search-and-replace, with backup
#leave the suffix off of -i to overwrite
perl -i.bak -pe 's/bart/milhouse/g' test.html
#echo the number of lines in a file
perl -lne 'END { print $t } @w = /(w+)/g; $t += @w' test.html
#cat file with line numbers
# -p prints $_ each iteration
perl -pe '$_ = "$. = $_"' test.html
# recursive search-and-replace, only on shells that support file globs
perl -i.bak -pe 's{bart}{milhouse}' **/*html
Category: Uncategorized |
Tags: Bash, batch, code, commandline, diamond, edit, editing, files, FileSystem, hacking, one-liners, perl, productivity, regex, replace, search, text, tips, tricks, wrapper
String.replaceAll method implementation
String.prototype.replaceAll = function(pcFrom, pcTo){
var i = this.indexOf(pcFrom);
var c = this;
while (i > -1){
c = c.replace(pcFrom, pcTo);
i = c.indexOf(pcFrom);
}
return c;
}
actionscript crawler
I am looking for an actionscript crawler. I always need to go thru all the lines of code to find instance names and its linkage. Let me know of any good software for this purpose. I hate eclipse. I am a Mac. Let me know@.
Category: Uncategorized |
Tags: actionscript, actionscriptcrawler, crawler, find, instance, linkage, replace, tags
Javascript search and replace
var str="foobar"; var val="foo"; var search='/'+val+'/i'; alert(str.replace(search, '<strong>'+val+'</strong>')); // it alerts "foobar" and not "<strong>foo</strong>bar"
SELECT REPLACE
<?php $query = " SELECT id, REPLACE(names,'".chr(29)."',', ') as namestring FROM table "; ?>