replace

PHP: How to get rid of all <![CDATA[ and ]]> occurrences in a string?

I tried this as a test: <?php $crap = "<![CDATA[Hello, world!]]>"; $crap = str_replace(list("<![CDATA[", "]]>"), "", $crap); echo $crap; ?> But it returned this: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ')' in /srv/www/htdocs/test.php on line 3 ...

Can I recover older Oracle pl/sql source code from a package body after i have replaced with newer code

I had created an Oracle PL/SQL package with a header and a body with lots of code. Later, I ended up accidentally erasing the code from that body after reran the CREATE OR REPLACE PACKAGE BODY... statement with different source code (which actually I intended to save under a different package name). Is there anyway I can recover my older...

PHP Dom problem, how to insert html code in a particular div

I am trying to replace the html code inside the div 'resultsContainer' with the html of $response. The result of my unsuccessful code is that the contents of 'resultsContainer' remain and the html of $response shows up on screen as text rather than being parsed as html. Finally, I would like to inject the content of $response inside 'r...

How to replace the following character with an empty space?

One of my datatable column value looks like the below, How to replace that character which is square in shape with a \n or an empty space using c#? Any suggestion... ClientAddress column holds value of a Multiline textbox.... The above character gets inserted into my table from a multiline textbox when the user enters a word and hit...

How to make string from regex and value of group

I have regexp for twitter profile url and someone's twitter profile url. I can easily extract username from url. >>> twitter_re = re.compile('twitter.com/(?P<username>\w+)/') >>> twitter_url = 'twitter.com/dir01/' >>> username = twitter_re.search(twitter_url).groups()[0] >>> _ 'dir01' But if I have regexp and username, how do I get ur...

Replace BIT values with some text

I have a BIT column with gender (0,1) and want to replace 0 and 1 in the resulting view with the words "man" and "woman". Can i do this right in the view with some system finction or i have to write my own function to do that? ...

Netlogo: error when putting variable in table, only constants allowe??

Hello, Currently I am working on a Netlogo program where I need to use nodes and links for vehicle routing problem. (links are called streets in the program) Here I have some practical problems of how to input variable linkspeed in a table with another node. Constants like 200 etc are fine. Online I found some examples where variables ...

php Preg_replace_callback problem

Hi I have the following code but im not a big fun of reg exp as they are too confusing: <?php $r = '|\\*(.+)\\*|'; $w = ''; $s = 'hello world *copyMe* here'; function callbk($str){ print_r($str); foreach($str as $k=>$v) { echo $v; } } $t = preg_replace_callback($r,'callbk',$s); //output: Array ( [0] => *copyMe* [1...

case sensitive string replacement in Python

I need to replace a string in case sensitive way. For example abc -> def Abc -> Def aBc -> dEf abC -> deF What can I do this with Python? ...

Saving substrings using Regular Expressions

I'm new to regular expressions in Java (or any language, for that matter) and I'm wanting to do a find using them. The tricky part that I don't understand how to do is replace something inside the string that matches. For example, if the line I'm looking for is Person item6 [can {item thing [wrap]}] I'm able to write a regex that fin...

Replace several tags from a text js

Hi! I have this pice of text I would like to change: [¿Cómo se procede cuando la mujer o pareja de un < b>fallecido< /b> pide la congelación del semen] So I would like to remove ], [ and < b>< /b> Is there any way to change it everything in the same time?? I tried: function replaceThings(){ jQuery(".summary").each(funct...

How to replace one object with another everywhere in the program?

I don't really think there is some method to do this… Anyway… How can I replace one object with another everywhere in the program? It would be like all the references to an old object start to point to a new one. ...

Find and Replace with Notepad++

I have a document that was converted from PDF to HTML for use on a company website to be referenced and indexed for search. I'm attempting to format the converted document to meet my needs and in doing so I am attempting to clean up some of the junk that was pulled over from when it was a PDF such as page numbers, headers, and footers. l...

How to replace text defined in a given tag or element using xslt, xslt string replace

Hi All, Please help me with this xslt transformation. Source Xml <xml> <test>This is a <bold>sample</bold> description. Please help me with a sample</text> </xml> Expected Output: This is a sample description. Please help me with a sample I just need to make bold only the specified text by the xml markup. Thank you ...

Backslashes in gsub (escaping and backreferencing)

Consider the following snippet: puts 'hello'.gsub(/.+/, '\0 \\0 \\\0 \\\\0') This prints (as seen on ideone.com): hello hello \0 \0 This was very surprising, because I'd expect to see something like this instead: hello \0 \hello \\0 My argument is that \ is an escape character, so you write \\ to get a literal backslash, thus \\...

Javascript replace

Hello struggling here guys.. Is it possible to string replace anything between the the first forward slashes with "" but keep the rest? e.g. var would be string "/anything-here-this-needs-to-be-replaced123/but-keep-this"; would end up like this string "/but-keep-this"; Hope that made sence ...

vb.net: Replace function with double quotes in From part

in vb.net how can i use replace function when the replace from part has double quotes in its value ? ...

Serving file via PHP script and safe replacing this file on-the-fly

My PHP script serves files using readfile() and manually added HTTP headers. Files are about ~1 MB big, so no partial-reading is necessary. What is the best way to replace this file with a updated one, but ensure already started downloads won't be broken? I'd like pending downloads to be finished with fetched old file version. Platform...

TSQL: How can I update the value of an xml tag with the value of an xml tag from another related table?

Hello, How can I update the value of an xml tag with the value of an xml tag from another related table? something like this: UPDATE v2 SET [xml].modify ('replace value of (//TAG1/text())[1] with "CAST(v1.[xml].query(''//TAG2'') AS NVARCHAR(MAX))"') FROM table2 v2, table1 v1 WHERE v2.id = v1.id Thanks ...

Javascript Replace text in string

I'm having some troubles getting regex to replace all occurances of a string within a string. **What to replace:** href="/newsroom **Replace with this:** href="http://intranet/newsroom This isn't working: str.replace(/href="/newsroom/g, 'href="http://intranet/newsroom"'); Any ideas? EDIT My code: str = '<A href="/newsroom/some_...