replace

Is there enough information to know what this regex is searching and replacing?

Could anyone explain what's being replaced here? I don't know if enough information is present to understand what's being searched and what's being replaced: regEx.Pattern = "(\s) *(\S)" regEx.Global = True that = regEx.Replace(that, "$1$2") ...

Replace Subversion Folder and Retain History

I have two development trees v3.3, and v3.4 in one SVN repository. They both contain a project called test-harness. However, the v3.4 developers have wrecked the test-harness so we need the test-harness from project in v3.3 to overwrite what we have in v3.4. I want to retain the history of change made to 3.4 test-harness as it has some i...

Javascript replace doesn't work when it should.

var src = "http://blah.com/SOMETHING.jpg"; src.replace(/.*([A-Z])\.jpg$/g, "X"); at this point, shouldn't src be: http://blah.com/SOMETHINX.jpg If I use match() with the same regular expression, it says it matched. Regex Coach also shows a match on the character "G". ...

Search and Replace of text in a memorystream in C# .NET

I have loaded a memorystream with a word document and I want to be able to alter specific text within the memorystream and save it back to the word document, like search and replace functionality. Please can anyone help me with this as I don't want to use the Word Interop libraries. I have the code to load and save the document already...

Remove whitespace and line breaks between HTML elements using jQuery

Using jQuery, I'd like to remove the whitespace and line breaks between HTML tags. var widgetHTML = ' <div id="widget"> <h2>Widget</h2><p>Hi.</p> </div>'; Should be: alert(widgetHTML); // <div id="widget"><h2>Widget</h2><p>Hi.</p></div> I think the pattern I will need is: >[\s]*< Can this be accomplished without...

Python: Replace values in list

Hello Stack Overflow Community, I have a list where I want to replace values with None where condition() returns True. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] For example, if condition checks bool(item%2) should return: [None, 1, None, 3, None, 5, None, 7, None, 9, None] What is the most efficient way to do this? ...

How to Replace a line in the same file by SED in Unix Shell scripting?

Hi In Reference to this question After getting the line identifier matching in first and second file I need to replace the line in first file with the line of second file.For that I am using SED as below. But Sed only replaces that line in a new file. How can I achieve the updation in same file without temporary file.(Because those are v...

Seach&Replace strings in PDF with perl/ruby/php

Hi! I'm looking for a way to script replacing strings in PDF documents. I can use either perl, ruby or php. If possible, regex would be a blast... Thank you! ...

mySQL/PHP to update if the row exists or else insert when column to check is not unique

I have read about REPLACE and INSERT ON DUPLICATE key queries, and while I can see how useful they are, they don't appear to work for my purposes. Perhaps my database design is off from how it should be, but either way I hope I can get this working. I am trying to mock up an online store to teach myself mysql and php, and I am recording...

PHP - Replace colour within image

I hope someone can help, I have made a script that masks images... however it is reliant on a colour to mask with ( 'green screen' style). The trouble is if the image that I am masking contains that colour it is ruined. What I am looking to do is prior to masking the image replace any occurance of my keying colour (0,0,255) with a simi...

Replace strings in file

Hi, I have to replace in a following manner if the string is "string _countryCode" i have to replace it as "string _sCountryCode" as you can see where there is _ I replace it with _s followd be next character in capitals ie _sC more examples: string _postalCode to be replaced as string _sPostalCode string _firstName to be replace a...

jquery .each loop and replace to same location?

i got help (http://stackoverflow.com/questions/1553601/jquery-select-a-tag-with-selector-from-a-text-veriable) on looping the static var and replacing it value, but just one question is left from it, is how can i replace finded tags with newly changed tags in the text area Code: var length = 30; var end = '...'; var text = `some st...

to remove href attr from all the anchor tags using Reg Ex

i am trying to remove href attr from all the anchor tags using Reg Ex,for print page. Although i need the text value in anchors. ...

Replacing all <br> with <br />

I'm using this (jQuery) to replace all <br>s with <br /> to clear out validation errors: $("<br>").replaceAll("<br />"); but it doesn't reduce any validation errors. Does validator check the original source? ...

Replace flash with javascript

Hello all, I have next mission: i have to replace flash alement with javascript in this page: http://www.fplus.si/ (changing the images with buttons for every image) Afcourse it has to look and work excactly the same. I found some jquery modules that do almost like this, but there are not the same. did somebody stumbled upon such modul...

SQL Server Express: REPLACE problem in SQL Server Mgmt Studio Express

Hello All I have a huge problem with the REPLACE SQL function in Microsoft SQL Server Management Studio Express. When I do following query SELECT REPLACE('ArticleNumber', 'S401', 'I0010') SELECT REPLACE('ArticleNumber', 'S302', 'I0020') SELECT REPLACE('ArticleNumber', 'S303', 'I0030') SELECT REPLACE('ArticleNumber'...

PHP - Replace strings in first array with values from second array

For some reason I'm struggling with this. I have the following 2 arrays and I need to take the array values from the $img array and insert them in order into the $text array, appending/replacing the %img_ tags, like so: $text = array( 0 => "Bunch of text %img_ %img_: Some more text blabla %img_", 1 => "More text %img_ blabla %i...

Awk/Sed: How to do a recursive find/replace of a string?

How to I find and replace every occurrence of: subdomainA.example.com with subdomainB.example.com in every text file under the /home/www/ directory tree (recursive find/replace). ...

PHP and Regex - storing a piece of the string for later use in replacement?

Not sure if the subject was clear, hard to describe, easy to show: I need to convert this: $text = 'Bunch of text %img_Green %img_Red and some more text here'; to this: $text = 'Bunch of text <img src="/assets/images/Green.gif" alt="Green" /> <img src="/assets/images/Red.gif" alt="Red" /> and some more text here'; Thanks in advan...

How can I add an underscore before each capital letter inside a Java String?

I have a string like this "HelloWorldMyNameIsCarl" and I want it to become something like "Hello_World_My_Name_Is_Carl". How can I do this? ...