replace

Jquery Replace with return value of Javascript function

OK I am just starting out with jQuery. I have a page with a table of date-values. Each is wrapped in a tag which I can find with $('mytag'). <mytag>2009-10-31</mytag> How, using Jquery, would I take each of the source values and pass it to a Javascript function then replace that source value within the table with the result of t...

jQuery replace all instances of a char in a node - working to a point

Hi clever people, This answer was almost exactly what I needed. After adding that fn, inline, at the top of my jQ code, I wrote this jQ lower down: $(":contains(|)").each(function() { replaceText('|', 'X'); }); This works, finding all pipe chars across the entire doc and replacing them with X. However I wanted to replace all pi...

replace eurosign in json

Hello, Can anyone help me with this one I have this query and only after adding the last one wich is indexed against the euro I get invalid json. $url = 'http://www.google.com/finance/info?client=ig&amp;q=goog,yhoo,AMS:TOM2'; $response= json_decode($response,true); The only thing different if I directly echo the output is the quest...

Search across Columns and replace text

I have an Access database of information where I need to replace text that may reside in 1 of 10 columns. I have a number of different requests for find and replace that need to be done. I need to do this twice a day. These are the details. We receive a download of data twice a day that has course information in it. A record can have 10...

Replace space with dash and make all letters lower case using javascript

I need to reformat a string using jquery or standard javascript Lets say we have Sonic Free Games I want to convert it to sonic-free-games So white spaces replaced with dashes and all letters converted to small letters Any help on this please ? ...

only keep A-Z 0-9 and remove other characters from string using javascript

i am trying to verify strings to make valid urls our of them i need to only keep A-Z 0-9 and remove other characters from string using javascript or jquery for example : Belle’s Restaurant i need to convert it to : Belle-s-Restaurant so characters ’s removed and only A-Z a-z 0-9 are kept thanks ...

Replace string in a specific line using python

I'm writing a python script to replace strings from a each text file in a directory with a specific extension (.seq). The strings replaced should only be from the second line of each file, and the output is a new subdirectory (call it clean) with the same file names as the original files, but with a *.clean suffix. The output file contai...

emacs: replace string using regexp

hi, suppose i have the following in a text file (or dired buffer) open in emacs: file_01.txt file_02.txt ... file_99.txt I want to query-replace or replace the files to 01_file.txt, etc. I want to use query-replace-regexp or replace-regexp, but don't know what to put in. The search part i put in "file_..", but the ".." are read as pe...

Replace symbol with tag using jquery

Hello Gurus, I have specification for products in text doc that I need to transfer into HTML. Might sound a bit strange but but what I'm trying to do is replace paragraph tags into two table columns, so this: <p>Load (kg):5,000, 10,000, 20,000, 30,000</p> <p>Excitation Voltage: 10vdc recommended, 20vdc maximum</p> into this <tr> ...

ANT + not replacing variables from a file list

This should be a simple one. I had another codebase that this worked but for some reason it wont work here at all. My file will.txt is unmodified. Here is an exerp from my ant build file .. Any ideas Ive wasted hours already banging my head trying to get it to work. <loadfile property="config.update.list" srcFile="config....

how to remove matched tags but leave content with JQuery

I have HTML like this: <div> <div class="a"> content1 </div> content 2 <div class="a"> <b>content 3</b> </div> </div> and I want to get rid of the div's of class="a" but leave their content. My initial attempt was: $("div.a").replaceWith($(this).html()); However this is undefined. How would you do this? ...

PHP: Return string between two characters

I am wanting to use "keywords" within a large string. These keywords start and end using *my_keyword* and are user defined. How, within a large string, can I search and find what is between the two * characters and return each instance? The reason it might change it, that parts of the keywords can be user defined, such as *page_date_Y...

Unique ID and multiple classes with XPath

Hi I'm using XSLT for displaying a ul menu containing li and a. I want the following: Find the first li a element and add the .firstitem class. Find the last li a element and add the .lastitem class. Find the active li a element and add the .active class. Add an unique ID to each li a element. (I.e. URL friendly menu text as ID). I...

shell script to find&replace section in xml

Hi, Im have a xml config file called solrconfig.xml, it has this section in the middle of it: <!--############ BEGIN replication settings DO NOT EDIT ################################--> <requestHandler name="/replication" class="solr.ReplicationHandler" > <lst name="master"> <str name="replicateAfter">commit</str> <str name="replic...

How can I find and replace text in XML using Perl?

My XML file looks something like this: <doc> <RU1> <conf> <prop name="a" val="http://a.org/a.html&gt; </conf> </RU1> <RAU1> <conf> <prop name="a" val="http://a.org/a.html&gt; </conf> </RAU1> <RU2> <conf> <prop name="a" val="http://a.org...

How to search and replace utf-8 special characters in Python?

I'm a Python beginner, and I have a utf-8 problem. I have a utf-8 string and I would like to replace all german umlauts with ASCII replacements (in German, u-umlaut 'ü' may be rewritten as 'ue'). u-umlaut has unicode code point 252, so I tried this: >>> str = unichr(252) + 'ber' >>> print repr(str) u'\xfcber' >>> print repr(str).repl...

Javascript replace a function with a new one containing dynamic contents

My Javascript knowledge is less experienced, so I might use wrong descriptions in the following. I have an object in a static .js file: var Info = { methodA: function() { // Call methodB. this.methodB('test'); }, methodB: function(value) { // Do stuff } } Now, in an .aspx file, I create a func...

replace keyword within html string.

I am looking for a way to replace keywords within a html string with a variable. At the moment i am using the following example. returnString = Replace(message, "[CustomerName]", customerName, CompareMethod.Text) The above will work fine if the html block is spread fully across the keyword. eg. <b>[CustomerName]</b> However if the...

javascript replace globally with array

You can use array for replacement: var array = {"from1":"to1", "from2":"to2"} for (var val in array) text = text.replace(array, array[val]); But what if you need to replace globally, ie text = text.replace(/from/g, "to"); Array is pretty big, so script will take a lot of space if I write "text = text.replace(...)" for every vari...

how in jquery can you click on a button and have a select dropdown turn to regular text

i want to have a table of select dropdowns and when you click "commit" all of the selects will simply be regular text inside the of the table. do i have to put the select inside of a div and remove and replace with raw html? ...