Is there a way to replace a portion of a String at a given position in javascript.For instance I want to replace 00 in the hours column with 12 in the below string.The substring comes at 13 to 15.
Mar 16, 2010 00:00 AM
...
Hello everybody!
I'm writing a small script which generates some configuration for devices. I want to have separate file, where I'm storing configuration, and change some strings during printing the content of the configuration to the browser. How can I replace string in a line of the file with a variable from $_POST['somevariable']?
--...
Hi folks,
I have a HTML document where I want to automatically have a version number added to all script and style sheet references.
the following should be replaced
<link ... href="file.css" media="all" />
<script ... src="file.js"></script>
<script ... src="http://myhost.com/file.js"></script>
with that
<link ... hre...
Hi I would like to replace all href and action attributes on a page with href="#" and action="#". Could someone point out where i am going wrong;
$(document).ready(function(){
var contents = $("body").html();
contents.replace( /href=[\"'][^'\"]*[\"']/g, 'href="#"' );
contents.replace( /action=[\"'][^'\"]*[\"']/g, 'action="#"' );
});
...
hello, i want to replace month name by number in array, but my script doesnt work.
for(i=0; i<a.length; i++) {
arr = arr.replace(/Jan/g, "01");
}
Can somebody help me please?
...
Hello, I am asking for your help with sed. I need to remove duplicate underscores and underscores from beginning and end of string.
For example:
echo '[Lorem] ~ ipsum *dolor* sit metus !!!' | sed 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._()-]/_/g'
Produces:
_Lorem____ipsum__dolor__sit_metus____
But I ne...
How can I replace a particular term in multiple files in Linux?
For instance, I have a number of files in my directory:
file1.txt
file2.txt
file3.txt
And I need to find a word "searchword" and replace it with "replaceword".
...
Hey everyone,
I have a string with special characters insert in different places. For example:
string myString = "This is a textbox: ##";
I would like to replace the ## with a control (namely, a textbox).
The Replace method only allows the string to be replaced with another string or character (understandably). But what would be t...
I don't know if this is even possible, I have the following regular expression (?<=[\?|\&])(?[^\?=\&#]+)=?(?[^\?=\&#]*)& which splits a URL into key/value pairs. I would like to use this in a replace function to build some markup:
string sTest = "test.aspx?width=100&height=200&";
ltTest.Text = Regex.Replace(sTest, @"(?<=[\?...
I have a .txt file containing data like this:
1,Rent1,Expense,16/02/2010,1,4000,4000
1,Car Loan1,Expense,16/02/2010,2,4500,9000
1,Flat Loan1,Expense,16/02/2010,2,4000,8000
0,Rent2,Expense,16/02/2010,1,4000,4000
0,Car Loan2,Expense,16/02/2010,2,4500,9000
0,Flat Loan2,Expense,16/02/2010,2,4000,8000
I want to replace the first...
I am opening the file in append mode. I need to replace lines 2,3, and 4 in the file, and later I need to add the new data at the end of the file.
...
I have this:
<input name="title" type="text" class="inputMedium" value="' . $inputData['title'] . '" />
I want to strip quotes from user input so that if someone enters something like:
"This is my title" it wont mess up my code.
I tried this and it's not working:
$inputData['title'] = str_replace('"', '', $_POST['title']);
...
What I'm trying to do is very simple, but I'm looking to do it most efficiently, preferably using php builtin fns.
$str = '1234';
echo replace_function(array('1','3'),array('3','1'),$str);
// output: 3214
str_replace,preg_replace would result in 1214, which means it goes through the arrays, replacing matched strings. I'm looking for ...
Hi,
So I figured out that the replace function, that finds all single-letter "words" (prepositions and conjunction, etc.) and replace the space after them with a to prevent leaving these characters at the end of line, should be something like
myString.replace(/\s\w(?=\s)/,"$1 ")
Now how do I apply it to all text on a webp...
Hi,
I need to remove the tag "image" with regex.
I'm working with C# .Net
example <rrr><image from="91524" to="92505" /></rrr> should become:
<rrr></rrr>
Anyone???
...
In SQL Server 2005, I have a Product search that looks like:
select ProductID, Name, Email
from Product
where Name = @Name
I've been asked to ignore a couple "special" characters in Product.Name, so that a search for "Potatoes" returns "Po-ta-toes" as well as "Potatoes". My first thought is to just do this:
select ProductID, Name, ...
How would I replace the first 150 characters of every line with spaces using sed. I don't want to bring out the big guns (Python, Perl, etc) and it seems like sed is pretty powerful in itself (some people have written the dc calculator in it for example). A related problem is inserting 150 spaces in front of every line.
s/^.\{50\}/?????...
Hi,
I have a .txt file containing data like this:
0,Rent1,Expense,16/02/2010,1,4000,4000
0,Car Loan1,Expense,16/02/2010,2,4500,9000
0,Flat Loan1,Expense,16/02/2010,2,4000,8000
0,Rent2,Expense,16/02/2010,1,4000,4000
0,Car Loan2,Expense,16/02/2010,2,4500,9000
0,Flat Loan2,Expense,16/02/2010,2,4000,8000
Now i want to replace ...
I have the following replace function
myString.replace(/\s\w(?=\s)/,"$1\xA0");
The aim is to take single-letter words (e.g. prepositions) and add a non-breaking space after them, instead of standard space.
However the above $1 variable doesn't work for me. It inserts text "$1 " instead of a part of original matched string + nbsp.
Wh...
Hello, does anyone know how to replace JavaScript on a site with Greasemonkey ie.
This is the default code:
var Test="1";
And i want to replace it like this on the page load:
var Test="2";
Thanks in advance!
...