replace

Replacing an item in memcached without changing the expiration time

I have several items on memcached that should expire 24h after the creation time. I need to update those items, while keeping the expiration time unchanged. How can I do this? Apparently the replace function requires an expiration parameter. ...

Is there a fast way to update many records in SQL?

I need to replace more than 20 000 names with new names i created given the CodeID. For example: I must update all rows that contain "dog" (which has a CodeID of 1) with "cat", and update all rows that contain "horse" (which has a CodeID of 2) with "bird", etc. 1st SQL statement: UPDATE animalTable SET cDescription = "cat" WHERE Code...

Getting wildcards to work in find and replace function in VBA macro for Microsoft Word

Hello all! Thanks in advance for your help! I have a VBA macro for Microsoft Word that I am trying to improve. The purpose of the macro is to bold and italicize all words in a document that match the search terms in the first table of the document. The problem is the search terms include wildcards which are the following: the hy...

PHP Multi Byte str_replace?

I'm trying to do accented character replacement in PHP but get funky results, my guess being because i'm using a UTF-8 string and str_replace can't properly handle multi-byte strings.. $accents_search = array('á','à','â','ã','ª','ä','å','Á','À','Â','Ã','Ä','é','è', 'ê','ë','É','È','Ê','Ë','í','ì','î','ï','Í','Ì','Î','Ï','œ','ò','ó',...

Tricky replacements in vb.net

I want to replace the text in a string "Sin()" with the computed value for Math.Sin() where is...anything. My problem: The string can have more than one right parenthesis. Also, since it is performing mathematical operations, it would have to know how to do the innermost ones first. Obviously, there is not a built in method for comput...

NSMutableArray replace with another NSMutableArray

im trying to replace an object inside a nsmutablearrayA (self) with another nsmutablearrayB, but someone when i tried to access the nsmutablearrayB inside of my nsmutablearrayA (self), it returns nil. i have no idea why it returns nil, here is my code. I have a nsmutablearray, each contents one UIImage object. NSMutableArray *tempStor...

Regular expression for splitting by char which might be escaped

I need to split a string similar to a path, which is delimited by dots. The tricky part is that the each subentry may also contain dots, which are escaped by another dot. Each entry may otherwise contain basically anything (including special characters such as space or :;/\|(), etc..) Two examples: "Root.Subpath.last/entry:with specia...

Is it possible to dock the "Find/Replace" window in Eclipse?

I could have sworn I saw it once before in a screencast where someone had the find/replace window docked in their Eclipse environment. However looking through the list of options in "Window > Show" the closest thing I can find is the Search window. I find that I use it quite a bit and with larger monitors these days I figure I could af...

Beginner Regex: Multiple Replaces

I have a string: $mystring = "My cat likes to eat tomatoes."; I want to do two replacements on this string with regex. I want to do s/cat/dog/ and s/tomatoes/pasta/. However, I don't know how to properly format the regular expression to do the multiple replacements in one expression, on one line, in one declaration. Right now, all I h...

replace/delete field using sqlalchemy

Two part question. Using postgres in python. 1) How do I replace all fields from the same column that match a specified value? For example, let's say I want to replace any fields that match "green" with "red" in the "Color" column. 2) How to delete all fields from the same column that match a specified value? For example, I'm trying to...

Replace all non digits with an empty character in a string

public static String removeNonDigits(final String str) { if (str == null || str.length() == 0) { return ""; } return str.replaceAll("/[^0-9]/g", ""); } This should only get the Digits and return but not doing it as expected! Any suggestions? ...

Simple preg_replace

I cant figure out preg_replace at all, it just looks chinese to me, anyway I just need to remove "&page-X" from a string if its there. X being a number of course, if anyone has a link to a useful preg_replace tutorial for beginners that would also be handy! ...

How do I Search/Find and Replace in an STL string

Is there a way to replace all occurrences of a substring with another string in std::string? For instance: void SomeFunction(std::string& str) { str = str.replace("hello", "world"); //< I'm looking for something nice like this } ...

how to remove a character with jquery

I have this: <span class="name"><span class="gost">Yahoo</span>, </span> I tried something like this, but no luck: $("span.name").html( $(this).replace(/,/g, '') ); ...

Replacing a querystring parameter value using mod_rewrite

I would like to map this: `http://www.example.com/index.php?param1=value1&amp;param2=value2&amp;param3=value3` (etc. ad infinitum) to `http://www.example.com/index.php?param1=newvalue1&amp;param2=value2&amp;param3=value3` (etc.) ie. just change the value of a single parameter in the querystring. I know what the old value is, so I a...

Remove characters from a string in C

I only have access to 'C' and need to replace characters within a character array. I have not come up with any clean solutions for this relatively simple procedure. I am passed a character array, for example: char strBuffer[] = "/html/scorm12/course/course_index.jsp?user_id=100000232&amp;course_id=100000879&amp;course_prefix=ACQ&amp;v...

How can I use jQuery to style /parts/ of all instances of a specific word?

Unusual situation. I have a client, let's call them "BuyNow." They would like for every instance of their name throughout the copy of their site to be stylized like "BuyNow," where the second half of their name is in bold. I'd really hate to spend a day adding <strong> tags to all the copy. Is there a good way to do this using jQuery? ...

How do I replace an asterisk in Javascript using replace()?

Using JQuery, I'm extracting the value from what is essentially a query box for some data in a MySQL database. Knowing that most users will use an '*' (asterisk) as a wildcard value and that MySQL uses the '%' character, I want to convert any asterisks to '%'. Normally, this would just be as simple as using queryString = inputText.rep...

SQL Statement Match Anything

I use a regex in my SQL statements for an app that look like this SELECT * FROM table WHERE id = {{REPLACEME}} However, sometimes I'm not giving a parameter to replace that string with. Is there a way to replace it with something that matches anything. I tried *, but that does not work. ...

Word VBA - Find text between delimiters and convert to lower case

I would like to find text which is between the < and > characters, and then turn any found text into "normal" case, where first letter of word is capitalized. Here is what I have thus far: Function findTextBetweenCarots() As String Dim strText As String With Selection .Find.Text = "<" ' what about <[^0-9]+> ? .Find.Forward =...