Hi,
I want to replace a link with its innerHTML, how is it done?
Example:
Bla bla bla <a href="#nogo">No link here</a> bla bla bla
has to become
Bla bla bla No link here bla bla bla
Tried to replace the node with its innerHTML but I can't get the text in the node itself..
I guess I have to work with regular expressions but I can...
I have a table defined as follows:
CREATE TABLE `mydb`.`users` (
`userID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`userName` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`createdDate` datetime NOT NULL,
`active` tinyint(1) NOT NULL,
`lastUpdatedDate` datetime NOT NULL,
PRIMARY KEY (`userID`,`userName`) USING BTREE
)
H...
Hi everyone.
We have a Server/Client cybercafe management application which used to work fine on Windows XP and Vista but now fails to run on Windows 7.
The Client was supposed to get 'Locked' on Client PCs of the Cybercafe, meaning it replaced Windows Explorer by changing the registry key
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windo...
I have a to match a field in MySQL, for which I thought I could use a regular expression, but it appears that MySQL doesn't have the functionality I need to do the job. Here's the scenario:
I have a variable in PHP called $url. Let's say this variable is set as the string "/article/my-article/page/2". I also have a table of URLs in M...
Hi
I want to replace the following line in C#. Replace first word with last word. I have to remove '[' and ']' from last word as well.
string oldString = "200 abc def abc [a18943]"
Output should be
string newString="a18943 abc def abc";
Thanks
...
I was trying to write a regexp to replace all occurrences of \n with \r\n unless the \n is already proceeded imediately by a \r. I'm doing this in Ruby 1.8.6 which doesn't support look behind in regexps so I tried:
# try to replace \n proceeded by anything other than \r with \r\n
str.gsub(/([^\r])\n/, "\\1\r\n") # \\1 is the captured ch...
I use the below function to retrieve characters one by one from a FILE stream.
Now the text in that file will sometimes include places holders like !first_name! within the text. What's the best way to detect when such a place holder start and when it ends so that I can swap each character between !! with proper character from another sto...
Ok I have a str_replace and what I want to do, is take values from an array, and take the next piece to replace the word "dog" with. So basically I want the $string to read:
"The duck ate the cat and the pig ate the chimp"
<?php
$string = 'The dog ate the cat and the dog ate the chimp';
$array = array('duck','pig');
for($i=0;$i<count($...
I have HTML data which I'll be using in a client app. I need to Regex.Replace the <a> tags from
<a href="Bahai.aspx">Bahai</a>
to
<a href="#" onclick="process('Bahai.aspx');return false;">Bahai</a>
In C# using RegExReplace with a regex similar to
<a[^>]*? href=\"(?<url>[^\"]+)\"[^>]*?>(?<text>.*?)</a>
Ideas?
...
Hi,
I wrote this function:
void r_tabs_spaces(char *input) {
int i;
for (i = 0; i < strlen(input); i++)
{
if (input[i] == ' ' || input[i] == '\t')
input[i] = '';
}
}
However when I compile this and run it, the compiler complains that "error: empty character constant" at line where...
I want to echo a string with the variable inside including the ($) like so:
echo "$string";
I dont want it to echo the variable for string, I want it to echo '$string' itself, and not the contents of a variable. I know I can do this by adding a '\' in front of the ($), but I want to use preg_replace to do it. I tried this and it doesn...
return mystring.replace(/&/g, "&").replace(/>/g, ">")
.replace(/</g, "<").replace(/"/g, """);
The above is my code, and I guess since it tracks the string 4 times, it makes it slower. Is there any other way (method prefered) to replace those special characters in only one loop? Well I can do it with a for loop an...
Hi Everyones,
I would like to remove one null byte in a string, and sometime replace it with another char.
Like that :
string = "41 00 36 00 36 00 00 00 57 00 46 00 42 00 41 00 61 00 62 00 73 00 20 00 36 00"
i was thinking about using random and replace, but replace always start by the first one:
replace("00","B",1)
So it's not ran...
I'm trying to do some batch replacement for/with a fairly complex pattern
So far I find the pattern as:
find '(' -name '*.php' -o -name '*.html' ')' -exec grep -i -n 'hello' {} +
The string I want to replace is currently as follow:
<img src="/some/path/to/somewhere/hello" />
where the path for the image varies but always contain t...
Hey there geniuses of SO!
This is for an autocomplete plugin that needs to accept data as an array of arrays and convert it using a format string (or regex). The format string could be any format.
var dataArray = [ ["data1-1", "data1-2", "data1-3"], ["data2-1", "data2-2", "data2-3"],... ];
var format = "<li>{0} <br /> -- <small> {1}, {...
Does anybody know how I could have, in a MySQL query, the same behaviour as the Regex.Replace function (for instance in .NET/C#)?
I need that because, as many people, I would like to count the number of words in a field. However, I'm not satisfied with the following answer (given several times on that site):
SELECT LENGTH(name) - LENGT...
I have some problem with replace string in Ruby.
My Original string : What the human does is not like what animal does.
I want to replace to: ==What== the human does is not like ==what== animal does.
I face the problem of case sensitive when using gsub. (eg. What , what) I want to keep original text.
any solution?
...
How do you search and delete a line (not replace) from multiple files in a directory tree? I have tried programs such as grepWin and Windows Grep but they replace lines, they do not delete the entire line. What is my best option?
Example: Search for "hello" and delete any line with "hello" in it.
yo
hello hey hey
hi hello
bye
bye
s...
public static class StringHelper
{
public static string HyphenAndSpaceReplacer(this string s)
{
string newString = s;
newString.Replace(char.Parse(" ", "_"));
newString.Replace(char.Parse("-", "_"));
return newString;
}
}
Error:
No overload for method 'Parse' takes '2' arguments
No overload for method 'Replace' takes '1...
I've converted html to a string, I'm able to use replace in that string to wrap the text with a link, and I can put that html back into the ID it came from.
My problem is that my replace method is going inside existing links on the page. This could create nested links, which is a problem. Does anyone out there know how to prevent the re...