Search Results

Search found 7529 results on 302 pages for 'replace'.

Page 1/302 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Search and replace global modifier

    - by mrucci
    Is there any reason why non-global/first-occurrence substitution is the default in many text editing programs (vim, sed, perl, etc.)? I am talking about the /g flag of search and replace commands like: :s/pan/focaccia/g # in vim sed 's/sfortuna/fortuna/g' # with sed that will substitute every occurrence of the search pattern with the replacement string. After (not too) many years of vim and sed usage I still did not find any use case for non-global substitutions. Is there some valid historical reason? Or it is because it is? Thanks.

    Read the article

  • python3: removing several chars from a string with a long chain of .replace().replace().replace()

    - by MadSc13ntist
    I found this example on stack overflow. I understand it, but seems like a bit much for such a simple method concept... removing several chars from a string. import string exclude = set(string.punctuation) s = ''.join(ch for ch in s if ch not in exclude) is there a builtin string method in python 3.1 to do something to the tune of: s = "a,b,c,d,e,f,g,h,i" s = s.strip([",", "d", "h"]) instead of: s = s.replace(",", "").replace("d", "").replace("h", "")

    Read the article

  • Replace this Hex chars from string in PHP

    - by Guillermo
    I'm generating an XML from data that comes from database (and some JSON feeds). I'm having some problems with some texts that contains some hex chars that are breaking my XML. For example, see this screenshot of the error I get from Chrome: I identified the hex characters that are giving me problems (I believe they're called control characters). And these are: 0x03 0x05 0x16 0x0E How can I replace those characters with PHP before printing them on my XML output? Thanks!

    Read the article

  • PHP Find and replace after in a string?

    - by TheBlackBenzKid
    I have some strings which contain the words LIMIT 3, 199 or LIMIT 0, 100. Basically I want to replace the word LIMIT and everything after it in my string. How do I do this in PHP? str_replace only replaces an item and the LIMIT text after is dynamic/ So it could be WHEN JOHN WAS TRYING HIS SQL QUERY, HE FOUND THAT LIMIT, 121 // RETURN WOULD BE WHEN JOHN WAS TRYING HIS SQL QUERY, HE FOUND THAT WHEN JOHN TRIED LIMIT 343, 333 HE FOUND // RETURN WOULD BE WHEN JOHN TRIED

    Read the article

  • js - using replace method to replace html element

    - by Rueta
    hi everyone! i have a question. I have a work this morning but i don't know how to do it. My work here (html): <div class="demo"> <p>this is demo text</p> </div> here is my JS : var tempdata = $(".demo").text(); var replacedata = tempdata.replace("text","<span>1234</span>"); Look everything ok. but result is : this is demo <span>1234</span>. this isn't my result i want. How to make in this string become a HTMLelement by using replace method?

    Read the article

  • Replace text with other text in the same line

    - by skerit
    I don't know if I can use regex for this, but I want to replace something in this xml: <custom-attribute name="Attribute_1" dt:dt="string">Danny Boyle</custom-attribute> <custom-attribute name="DVD-releasedatum" dt:dt="string">06/10/1999</custom-attribute> should become <Attribute_1>Danny Boyle</Attribute_1> <DVD-releasedatum>06/10/1999</DVD-releasedatum> Removing this from the first tag isn't hard, but how can I close my newly formed tag?

    Read the article

  • jquery find and replace multiple items

    - by client
    I have a monthly table that needs to be translated for each languages Something like this (doesnt work obviously) $('.lang-en #monthly th').each(function() { var text = $(this).text(); $(this).text(text.replace('Tam', 'Jan')); $(this).text(text.replace('Hel', 'Feb')); $(this).text(text.replace('Maa', 'Mar')); $(this).text(text.replace('Huh', 'Apr')); $(this).text(text.replace('Tou', 'May')); $(this).text(text.replace('Kes', 'Jun')); $(this).text(text.replace('Hei', 'Jul')); $(this).text(text.replace('Elo', 'Aug')); $(this).text(text.replace('Syy', 'Sep')); $(this).text(text.replace('Lok', 'Oct')); $(this).text(text.replace('Mar', 'Nov')); $(this).text(text.replace('Jou', 'Dec')); $(this).text(text.replace('Yht', 'Total')); });

    Read the article

  • PHP Replace chars by functions

    - by user1860570
    I try change characters by functions <?php $string = "Hi everybody people [gal~images/articles~100~100~4] here other imagen [gal~images/products~100~100~3]"; $regex = "/\[(.*?)\]/"; preg_match_all($regex, $string, $matches); for($i=0; $i<count($matches[1]);$i++) { $match = $matches[1][$i]; $array = explode('~', $match); //$newValuet="gal("".$array[1]."","".$array[2]."","".$array[3]."","".$array[4]."")"; $newValue="gal(".$array[1].",".$array[2].",".$array[3].",".$array[4].")"; $string = str_replace($matches[0][$i],$newValue,$string); } echo $string; ?> The problem here : $newValue="gal(".$array[1].",".$array[2].",".$array[3].",".$array[4].")"; $string = str_replace($matches[0][$i],$newValue,$string); Function no give the right results i try differents methods but continue the problems , please i see all functions but no get this works if you can answer please put me some modification of this code for i can understand , thank´s a lot for all help

    Read the article

  • replace all link href's with return of a function, with regex

    - by Rajat Singhal
    I have a function which returns a modified url, if passed a url.. I need to call this function on hrefs of all the links in my html data.. I can't use DomDocument, it's in php cli, I need regex solution.. I have tried preg_replace, and preg_replace_callback, but I simply don't understand the whole concept of using $1, $2 in the replacement string..If somebody can point to a good documentation,that'll be great too.. function modifyUrl($old_url) { ...... return $new_url; } $html = "...";//Long html content having links //need to call modifyUrl for all link's hrefs..

    Read the article

  • Find and Replace several several different values all at once

    - by matt
    I have a file with multiple instances of Text_1 and Text1 and I need to replace both those strings with Text_A and TextB respectively. Currently I'm doing two Find and Replace functions on each file one that finds Text_1 and replaces it with Text_A and the other that finds Text1 and replaces it with TextB. Is there any way to do this all at once instead of having to run "Find and Replace" twice? I am using Dreamweaver CS3, but I also have Notepad++, regular Notepad, OO Writer, MS Word if those will be easier. Ideally I could do this in Dreamweaver or Notepad++ but I'm open to downloading something else to get the job done. I'd prefer not to have to do any command line stuff or create a batch file (while I'm aware of it, I don't understand it really). Edit: In case the above description isn't clear, let me explain it this way... I want to run Find & Replace 1 time in 1 document and I want it to do ALL of the following during that one Find & Replace instance: Find: Text_1 and Replace with: Text_A Find: Text1 and Replace with: TextB I am not trying to do a Find and Replace across several documents.

    Read the article

  • I want to search and replace multiple values in a table column in one MYsql querry.

    - by user204245
    Query to Where X update Y and where A update B in a Mysql Table column. How can I Do this in MYsql in one querry on the same column in a specific table. I want to search and replace multiple values in a table column. Conditons in table1 in column1 Where X update Y and Where a update b and Where 1 update 2 and Where 3 update 4 and Where value1 update value 2 And So on. I can individually do this but how can I do this faster is there a mysql function to help me with this. I have about 120 columns with 200 search and replace/update values for each column. Thanks.

    Read the article

  • Text-Editing program : muti-search-replace/multi-regex?

    - by rlb.usa
    I have a long and arduous text file, and I need to do lots and lots of the same search-replaces on it inside of selections. Is there a text editing program where I can do multiple find/replace (or regex) at one time? That is, I want to : (select text) - (do-find-replace-set-A) - (do other stuff) - (repeat) Instead of : (select text) - (f&r #1, f&r #2, f&r #3 ... ) - (do other stuff) - (repeat) I have textpad, but it's macro's won't handle find/replace.

    Read the article

  • ms excel find and replace @ symbol results in broken formula

    - by Loopo
    I'm trying to search and replace in excel, the column is formatted as 'Text'. Find: [@ replace with: @ Whenever this finds a match at the start of a cell i.e the cell contents start with [@ and tries to replace that with @ the result is an error 'This function is not valid' I guess that since the @ operator is for references, this is causing the cell to be interpreted differently (not as text anymore) How do I make this replacement work? Copy/paste into another program is not a good option because some of the cells contain line-breaks.

    Read the article

  • Notepad++ find string with a new-line and replace

    - by Giraldi Maggio
    [Notepad++ Question] How do I use find-and-replace to replace the attribute of a series of tags using expression? Case scenario: Let's say I have a couple of lines of something like this: <li><a title="Bla bla" href= "http://www.url.com/etc">Text</a></li> And I want to replace them with this: <li><a title="Bla bla" href="">Text</a></li> Note the new line and double tabs on the original.

    Read the article

  • Replace text with spaces in MySQL

    - by javipas
    I'm trying to do a global replace of search in my database, which has a lot of articles with a double carriage return because of this code: <p> </p> I'd like to replace this in my WordPress blog so instead of that appears... nothing, and so I can delete the CR. I've tried this on my database UPDATE wp_posts set post_content = replace (post_content,'<p> </p>',''); but didn't work. Why? Do I have to add special thinks to consider the space between the <p>and the</p>? Mmm. Good points, both Jon Angliss and Wim. Jon, as you could have guessed, the database shows no entries with that text string. So there's something going on inside the post_content field. Wim, the famous   was replaced previously, but there are still hundreds of posts that for some reason have something different between the p and the /p tags. I've done a search of one of the posts with this error: mysql> select * from wp_posts where post_title like '%3DVisionLive%'; And looking in the wp_content field, this is a little piece of the post: Phil Eisler, responsable de la divisi?n 3D Vision.?</p> <p>?</p> <p>Este portal ser? por tanto No spanish tilde (accent) shown on the terminal, and instead of an space there's a quotation mark between the p and the /p tags. I've tried to replace <p>?</p>, but again, no results. There's some character (or several) there, but I don't know how to discover that. Maybe it's the character set of my terminal, but I've accessed the database from phpmyadmin and in that case there's a space character between the p and the /p. Weird.

    Read the article

  • command line find/replace help

    - by Chrisbloom7
    I've got a set of 5000+ files that I need to do a simple search and replace in. I have been doing it in a text editor (EditPlus) by opening 500 files at a time, doing a global search/replace, saving all, closing, etc. But, that's taking literally hours to do and it's boring and tedious and I already have done it once today and need to do it again because all the files got refreshed. Is there a way to do this via the Bash command line? Here's the details: Find onchange="document.location ='/products/view.html/view/'+this.value" Replace it with onchange="alert('Not implemented')" style="display: none" All of the files have a .HTM extension, but they are nested in several sub directories.

    Read the article

  • Regular Expression to replace part of URL in XML file

    - by Richie086
    I need a regular expression in Notepad++ to search/replace a string. My document (xml) has serveral thousand lines that look similar to this: <Url Source="Output/username/project/Content/Volume1VolumeName/TopicFileName.htm" /> I need to replace everything starting from Volume1 to .htm" / to replaced with X's or some other character to mask the actual file names in this file. So the resulting string would look like this after the search/replace was performed: <Url Source="Output/username/project/Content/Volume1XxxxxxXxxx/XxxxxXxxxXxxx.htm" /> I am working with confidential information that I cannot release to people outside of my company, but i need to send an example log file to a 3rd party for troubleshooting purposes. FYI the X's do not need to follow the upper/lower case after the replacement, i was just using different case X's for the hell of it :)

    Read the article

  • Multiple REPLACE function in Oracle

    - by Adnan
    I am using the REPLACE function in oracle to replace values in my string like; SELECT REPLACE('THE NEW VALUE IS #VAL1#','#VAL1#','55') from dual So this is OK to replace one value, but what about 20+, should I use 20+ REPLACE function or is there a more practical solution. All ideas are welcome.

    Read the article

  • Using LINQ to SQL and chained Replace

    - by White Dragon
    I have a need to replace multiple strings with others in a query from p in dx.Table where p.Field.Replace("A", "a").Replace("B", "b").ToLower() = SomeVar select p Which provides a nice single SQL statement with the relevant REPLACE() sql commands. All good :) I need to do this in a few queries around the application... So i'm looking for some help in this regard; that will work as above as a single SQL hit/command on the server It seems from looking around i can't use RegEx as there is no SQL eq Being a LINQ newbie is there a nice way for me to do this? eg is it possible to get it as a IQueryable "var result" say and pass that to a function to add needed .Replace()'s and pass back? Can i get a quick example of how if so? EDIT: This seems to work! does it look like it would be a problem? var data = from p in dx.Videos select p; data = AddReplacements(data, checkMediaItem); theitem = data.FirstOrDefault(); ... public IQueryable<Video> AddReplacements(IQueryable<Video> DataSet, string checkMediaItem) { return DataSet.Where(p => p.Title.Replace(" ", "-").Replace("&", "-").Replace("?", "-") == checkMediaItem); }

    Read the article

  • Find/Replace Paragraph End (^13) in Microsoft Word 2007 Merges Paragraphs

    - by Mike Blyth
    I need to replace a target at the beginning of lines with something else. Without wildcards, I can say to replace "^pTarget" with "^pReplacement". With wildcards enabled, I use replace "^13Target" with "^13Replacement". The replacement is successful except that the paragraph is now merged with the previous one in a strange way: The end-paragraph mark is still in place and the paragraph begins on a new line, but Triple clicking to select paragraph selects both the changed paragraph and the one above In a macro, starting in the paragraph above and extending the selection to the end of paragraph causes both paragraphs to be selected. Inter-paragraph spacing disappears between the changed paragraph and the one above. In essence, the paragraph boundary has been removed although the end-paragraph mark is still shown. To duplicate this problem, make a new document Line 1 Line 2 Line 3 (separate paragraphs). Find and replace (with wildcards on) "^13" with "^13". If your result is the same as mine, you will see the problems listed above. I can work around this in the usual way of replacing ^p with something else first, e.g. "^p" = "$", then "$target" = "$replacement", but I'm curious about what's going on. (This is using Word 2007 on Windows 7) I don't know Word XML, but the XML output seems to correspond with the above. Replacing ^13 with ^13 moves the paragraphs together in almost the same way as replacing end-paragraph with end-line (^p = ^l). Here is the relevant XML of the original "Line 1, Line 2, Line 3" in separate paragraphs: <w:p w:rsidR="00BB3032" w:rsidRDefault="00027252"> <w:r><w:t>Line 1</w:t></w:r> </w:p> <w:p w:rsidR="00027252" w:rsidRDefault="00027252"> <w:r><w:t>Line 2</w:t></w:r> </w:p> <w:p w:rsidR="00027252" w:rsidRDefault="00027252"> <w:r><w:t>Line 3</w:t></w:r> </w:p> Now after replacing ^13 with ^13: <w:p w:rsidR="00027252" w:rsidRDefault="00027252"> <w:r><w:t>Line 1</w:t></w:r> <w:r w:rsidR="00C57863"><w:cr/></w:r> <w:r><w:t>Line 2</w:t></w:r> <w:r w:rsidR="00C57863"><w:cr/></w:r> <w:r><w:t>Line 3</w:t></w:r> <w:r w:rsidR="00C57863"><w:cr/></w:r> </w:p> Now original after replacement of ^p with ^l (convert end-paragraph to end-line) <w:p w:rsidR="00027252" w:rsidRDefault="00027252"> <w:r><w:t>Line 1</w:t></w:r> <w:r w:rsidR="00AC7B51"><w:br/></w:r> <w:r><w:t>Line 2</w:t></w:r> <w:r w:rsidR="00AC7B51"><w:br/></w:r> <w:r><w:t>Line 3</w:t></w:r> <w:r w:rsidR="00AC7B51"><w:br/></w:r> </w:p>

    Read the article

  • Java replace slow?

    - by cpf
    Hi StackOverflow, I have a Java application that makes heavy use of a large file, to read, process and give through to SolrEmbeddedServer (http://lucene.apache.org/solr/). One of the functions does basic HTML escaping: private String htmlEscape(String input) { return input.replace("&", "&amp;").replace(">", "&gt;").replace("<", "&lt;") .replace("'", "&apos;").replaceAll("\"", "&quot;"); } While profiling the application, the program spends roughly 58% of the time in this function, a total of 47% in replace, and 11% in replaceAll. Now, is the Java replace that slow, or am I on the right path and should I consider the program efficient enough to have its bottleneck in Java and not in my code? (Or am I replacing wrong?) Thanks in advance!

    Read the article

  • Is str.replace(..).replace(..) ad nauseam a standard idiom in Python?

    - by meeselet
    For instance, say I wanted a function to escape a string for use in HTML (as in Django's escape filter): def escape(string): """ Returns the given string with ampersands, quotes and angle brackets encoded. """ return string.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace("'", '&#39;').replace('"', '&quot;') This works, but it gets ugly quickly and appears to have poor algorithmic performance (in this example, the string is repeatedly traversed 5 times). What would be better is something like this: def escape(string): """ Returns the given string with ampersands, quotes and angle brackets encoded. """ # Note that ampersands must be escaped first; the rest can be escaped in # any order. return replace_multi(string.replace('&', '&amp;'), {'<': '&lt;', '>': '&gt;', "'": '&#39;', '"': '&quot;'}) Does such a function exist, or is the standard Python idiom to use what I wrote before?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >