replace

Replace links from specific domain with text (PHP)

Hi guys. I have : <a href="http://abc.com"&gt;Title&lt;/a&gt; And : <a href="http://xyz.com"&gt;Title&lt;/a&gt; I want to replace link to text "Title", but only from http://abc.com. But I don't know how ( I tried Google ), can you explain for me. I'm not good in PHP. Thanks in advance. ...

Remove <p class="classname"> in Javascript?

How can i remove this <p> tag with all its content in javascript? say i have this html code <p class="classname"> <input name="commit" value="Get Value" type="submit"> <span>or Cancel</span> </p> Now i need to replace/remove it in javascript, does anyone know how i can remove it? ...

Javascript replace content of string but not in start and end tag? pls help

Hi all i need your help ! i wanna write javascript function to change the text Lasvegas in string: ex: "Hello every one in Lasvegas, come <a href='xxx'>Lasvegas</a> with me" How can i change the text but not change content Lasvegas in start tag and end tag ...

Replacing characters with specified one

Hello All, I have a string as follows - MFMFMF now i want to change this string to FMFMFM how to do this , help needed pls i had tried select replace(replace('mfmfmf','M','F'),'F','M') this gives me result - MMMMMM which i donot what i want the output to be FMFMFM Need your help D.Mahesh ...

Javascript replace last occurence of text in a string

Hi all see my code snippet below: var list = ['one', 'two', 'three', 'four']; var str = 'one two, one three, one four, one'; for ( var i = 0; i < list.length; i++) { if (str.endsWith(list[i]) { str = str.replace(list[i], 'finsih') } } I want to replace the last occurence of the word one with the word finish i...

c# replace JSON area

I have a JSON containing imbricated arrays, maps and primitive values. Is there a way to replace a whole map by knowing the key that is set with ? e.g. in ["a":"aaa", "map1":{"int1":1, "map2":{"int2":2}, "data":null}] I would like to replace the string representing map2 and get ["a":"aaa", "map1":{"int1":1, "data":null}] ...

Replacing ’ character in PHP

Hello, I'm having a hard time trying to replace this weird right single quote character. I'm using str_replace like this: str_replace("’", '\u1234', $string); It looks like I cannot figure out what character the quote really is. Even when I copy paste it directly from PHPMyAdmin it still doesn't work. Do I have to escape it somehow? ...

removing non ascii characters from a string using python / django

I have a string of HTML stored in a database. Unfortunately it contains characters such as ® I want to replace these characters by their HTML equivalent, either in the DB itself or using a Find Replace in my Python / Django code. Any suggestions on how I can do this? ...

SQL Replace Into question

With Replace Into, if I have two fields. FirstName LastName. The table has John Smith in it, if I was to run REPLACE INTO tblNames (FirstName, LastName) VALUES (John, Jones) Would that replace Smith with Jones, or create a new name? What determines if its an Update or and Insert? ...

How can I include the period (.) in Vim's search and replace command? (replacing .html extensions)?

When I do: /.html Vim looks for html I would like to replace all the .html with .php Something like this: :%s/html ext/php ext/g ...

javascript replace i into I

I need a javascript to replace i into I. This should apply to cases such as i'm good. So am i. He though i love him. The standard ThisContent = ThisContent.replace("i", "I"); doesn't work because it replaces every i. I also thought of ThisContent = ThisContent.replace(" i ", " I "); but it doesn't work for the first and second case....

R: How to replace elements of a data.frame?

I'm trying to replace elements of a data.frame containing "#N/A" with "NULL", and I'm running into problems: foo <- data.frame("day"= c(1, 3, 5, 7), "od" = c(0.1, "#N/A", 0.4, 0.8)) indices_of_NAs <- which(foo == "#N/A") replace(foo, indices_of_NAs, "NULL") Error in [<-.data.frame(*tmp*, list, value = "NULL") : new columns woul...

trying to fade out a top div on hover to reveal working links in text below using JQuery

I need to fade a div (and image) to reveal a div underneath (text with clickable links) using jQuery. <script> $(document).ready(function(){ $("img.a").hover( function() { $(this).stop().animate({"opacity": "0"}, "slow"); }, function() { $(this).stop().animate({"opacity": "1"}, "slow"); }); }); </script> Used the above code and all w...

Advanced Regex: Smart auto detect and replace URLs with anchor tags

I've written a regular expression that automatically detects URLs in free text that users enter. This is not such a simple task as it may seem at first. Jeff Atwood writes about it in his post. His regular expression works, but needs extra code after detection is done. I've managed to write a regular expression that does everything in ...

PHP - Removing the effect of HTML tags in string - BUT displaying them as well?

Hi. Consider strip_tags() . strip_tags("<b>TEXT</b>"); Output: TEXT But what if i want to nullify the effect of the tags but display them as well? Output: <b>TEXT</b> Would i have to use preg_replace() ? Or is there a more elegant solution available? Thanks :D ...

Find and Replace a section of a string with wildcard type search

I want to be able to read a file, and replace all instances of: M9S1800.2 with S1800 (I want to get rid of the M9 and the .2). The problem I am having is that the 4 digit number after the "S" can be different every time, as well as the number after the decimal. For example, It can be: M9S3200.1 or M9S5400.1 or M9S5400.2 Can so...

string.replace seriously broken with \

"C://test/test/test.png" -> blub blub = blub.Replace(@"/", @"\"); result = "C:\\\\test\\test\\test.png" how does that make sense? It replaces a single / with two \ ? ...

Create a new output file in ant replace task

Ant replace task does a in-place replacement without creating a new file. The below snippet replaces tokens in any of the *.xml files with the corresponding values from my.properties file. <replace dir="${projects.prj.dir}/config" replacefilterfile="${projects.prj.dir}/my.properties" includes="*.xml" summary="true"/'> I want those ...

Python: replace urls with title names from a string

Hello I would like to remove urls from a string replace them with their titles of the original contents. For example: mystring = "Ah I like this site: http://www.stackoverflow.com. Also I must say I like http://www.digg.com" sanitize(mystring) # it becomes "Ah I like this site: Stack Overflow. Also I must say I like Digg - The Latest ...

Bash - replacing targeted files with a specific file, whitespace in directory names

I have a large directory tree of files, and am using the following script to list and replace a searched-for name with a specific file. Problem is, I don't know how to write the createList() for-loop correctly to account for whitespace in a directory name. If all directories don't have spaces, it works fine. The output is a list of file...