replace

Java : replacing all URLs with anchor tags that aren't already in anchor tags

Hey, I'm trying to replace all non-anchor-tag-enclosed URLs within anchor-tag-enclosed URLs for a document. So given the string: I have two urls for google: <a href="http://www.google.com/"&gt;google&lt;/a&gt; and http://www.google.com/ I would like to replace it with this: I have two urls for google: <a href="http://www.google.com/...

Replace all fields in MySQL

Hi, I need to replace some chars in the columns of a table, by using the REPLACE command. I know that the REPLACE command needs a column name, then the text to change (in the following example, the 'a' char) and the new text (in the following case, the 'e' char). UPDATE my_table SET my_column = REPLACE (my_column,'a','e' ); So that ...

Replace all "\n" with ","

I have a textarea and I want to replace "\n" with "," in it's value. var valuetxtarr = $("#txtarr").val(); var valuetxtarrs = valuetxtarr.replace("/\n/g",","); alert(valuetxtarrs); But it don't work?Why?Where I have mistake? ...

MySQL regex replace?

I've got a table with blob text fields. This blob has a lot of html in it. One of the pieces of html is an h2. I would like to find all instances of a word in the h2 tag, and replace it with another word (while leaving other words the same). For example, I would like to replace the h2 "wiggles" with "bumbles" in the following: Before: ...

How to automatically insert predefined text into a string in positions definable by a regular expression

I'd like to use javascript to search a string and automatically insert a closing tag before every occurrence of an opening tag. Here is the test code I've come up with so far: var str="<span>this <i>is</i> a <i>test</i></span>"; var patt1=/<(?!span)\b\w+>/g; var patt2=/<\/(?!span)\b\w+>/g; document.write(str.replace(patt1, '</b>' + str...

Replace/Add several DOM Elements: Efficient and robust Method?

I am in search for an efficient method to replace a couple of DOM Elements - if possible in one action only. It is needed for augmenting TextNodes. If a certain word is present, it shall be wrapped in span-Tags, to which an event handler needs to be assigned later. so if a text Node contains the word it needs to turn from -#textNode ...

How to do Multi file find and replace from unix prompt

I want to replace 'localhost' with an actual ip like '1.1.1.1' in every file in a directory including subfolders, plus I want it to log the filenames it changed. I'm having a difficult time doing this, what command should I use? ...

Use Regex to replace HREFs

I have html email that I would like to track click activity. I need to update all hrefs within the email to point back to my server where they can be logged and redirected. Is there an easy way to do this globally using .Net regex? <a href="http://abc.com"&gt;ABC&lt;/a&gt; becomes <a href="http://mydomain.com?uid=123&amp;url=http:/ab...

PHP replace text in variable

$image variable gives this code (when echo is used): <img src="/image.png" width="100" height="147" alt="" class="some_class" /> width, height, src and class attributes can be different. What should we do: remove width and height from $image replace alt="" with alt="Poster" Thanks. ...

[php] [spin] Finding string and replacing with same case string

Hello, I need help while trying to spin articles. I want to find text and replace synonymous text while keeping the case the same. For example, I have a dictionary like: hello|hi|howdy|howd'y I need to find all hello and replace with any one of hi, howdy, or howd'y. Assume I have a sentence: Hello, guys! Shouldn't you say hel...

Replace using RegEx outside of text markers

I have the following sample text and I want to replace '[core].' with something else but I only want to replace it when it is not between text markers ' (SQL): PRINT 'The result of [core].[dbo].[FunctionX]' + [core].[dbo].[FunctionX] + '.' EXECUTE [core].[dbo].[FunctionX] The Result shoud be: PRINT 'The result of [core].[d...

Replacing content in the modal window

Hi, When my page is served, I am writing several divs to the page which are later displayed in a simplemodal. I would like to be able to "navigate" between these different content blocks WITHIN the modal window. I tried using .replaceWith(), but the modal container disappears when I do this, and if I just call modal() again when it's ...

regular expression: replace match with its index

How can I transform the string "a b a c d a a" into the string "1 b 2 c d 3 4" with a regular expression? Is this possible? Preferred flavor is perl, but any other will do too. s/a/ \????? /g ...

Transforming some special caracters (é,è,...) into "e"

Hello, I have a question related to Java in my android application. I have a list with some Belgian cities with accentued ( is that the right english word?) characters: (Liège,Quiévrain,Franière, etc.) and I would like to transform these special characters to compare with a list containing the same names in upper case, but without thes...

XSLT - replace value in one node with the value from it's preceeding sibling

Hi There, I'm trying to write an XSLT transformation which will replace the value in one node with the value of it's preceding sibling. Then return the entire document transformed :) Find the occurrences of <package:packageDownloadLocator>http://myunwantedurl&lt;/package:packageDownloadLocator&gt; and replace with the text value of i...

Clearing Cell Values Within HTML

In my HTML code, I've got a certain cell whose value should be cleared if a link button is pressed. I'd like to achieve this using jQuery and here's how I tried to do it but with no results: var $delActionDate = $('#delete_Event'); $delActionDate.live('click', function() { var myRow = $delActionDate.parent().parent...

JavaScript .replace only replaces first Match

var textTitle = "this is a test" var result = textTitle.replace(' ', '%20'); But the replace functions stops at the first instance of the " " and I get the Result : "this%20is a test" Any ideas on where Im going wrong im sure its a simple fix. ...

Javascript - Replace '%20' spaces

var loc_array = document.location.href.split('/'); var linkElement = document.getElementById("waBackButton"); var newT = document.createTextNode(loc_array[loc_array.length-2]); var repl = newT.replace('%20',' '); linkElement.appendChild(repl); Anyone know why this causes the text to not show up? ...

LOAD DATA INFILE REPLACE doesn't seem to work with multiple fields?

I'm loading a file into a table with php. I create a table like this: CREATE TABLE IF NOT EXISTS $table ( `id` INT AUTO_INCREMENT PRIMARY KEY, `order` INT DEFAULT 0, `data` VARCHAR(200) UNIQUE, `cur_timestamp` TIMESTAMP DEFAULT NOW())"; And fill it from a text file like this: LOAD DATA LOCAL INFILE '".$file ."' REPLACE INTO TABLE $...

adding characters at the start and end of each line in a file

What is the best way to add some characters at the start and end of each line? something like quotes etc? Can it be done using Vim, or some other way? ...