Search Results

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

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

  • Visual Studio Find and Replace Regular Expressions ~ find lines with quoted strings, not containing

    - by Darkoni
    Visual Studio Find and Replace Regular Expressions Find lines with quoted strings, not containing strings include or trace i am tryling to find out all lines in c++ project that contains some text as i have to use visual studio, i have to use its Find and Replace http://www.codinghorror.com/blog/2006/07/the-visual-studio-ide-and-regular-expressions.html so, for finding all lines like: print("abc"); it is enogh to write :q and it will find all quotted strings ok, but i also get lot of lines like #include "stdio.h" and trace("* step 1 *") i find out regex to get all lines containing include and trace <include|trace> so, mine question is, how to find all lines with "quotted strings" but NOT lines that contains strings include and trace. thanx

    Read the article

  • Replace or recode several different values by a single value in an Excel file

    - by Ali
    Hi all, I have an Excel worksheet which contains data in several columns. For a specific column, I will need Excel to replace all values between, say 10 to 15, by the value 1 and values between 16 and 20 by the value 2 and so forth. I know how to do it for a single value; ie: I can replace value 10 by 1, 11 by 1 and so on. But this will be a tedious exercise. Are there some lines of codes that can execute this task? Thanks for your help. regards, Ali

    Read the article

  • "Simple" Text replace function

    - by YourMomzThaBomb
    I have a string which is basically a list of "words" delimited by commas. These "words" can be pretty much any character e.g. "Bart Simpson, Ex-girlfriend, dude, radical" I'm trying to use javascript, jQuery, whatever i can to replace a word based on a search string with nothing (in essence, removing the word from the list). For example, the function is defined as such: function removeWord(myString, wordToReplace) {...}; So, passing the string listed above as myString and passing "dude" as wordToReplace would return the string "Bart Simpson, Ex-girlfriend, radical" Here's the line of code I was tinkering around with...please help me figure out what's wrong with it or some alternative (better) solution:$myString.val($myString.val().replace(/wordToReplace\, /, ""));

    Read the article

  • Replace text in folder names

    - by dannyb
    How can I replace the same text in folder names in linux? Say I have "Photos_Jun", "Photos_July", "Photos_Aug", etc. whats the simplest way I can rename them like "Photos Jun", "Photos July", etc (basically I want to replace the underscore with a space " ". I have about 200 of these folders. I was looking at solution: http://stackoverflow.com/questions/1836563/how-can-i-easily-bulk-rename-files-with-perl It looks like what im looking for however, I dont know how to make a regular expression to match folders that are alphanumeric followed by a "_". All files have non-numeric names, so I think [a-zA-Z] is the right way to start. perl -e 'foreach $f (glob("File\\ Name*")) { $nf = $f; $nf =~ s/(\d+)$/sprintf("%03d",$1)/e; print `mv \"$f\" \"$nf\"`;}' Thanks for any help!

    Read the article

  • C# Find and Replace RegEx question

    - by fraXis
    Hello, I am starting to get a grip on RegEx thanks to all the great help here on SO with my other questions. But I am still suck on this one: My code is: StreamReader reader = new StreamReader(fDialog.FileName.ToString()); string content = reader.ReadToEnd(); reader.Close(); I am reading in a text file and I want to search for this text and change it (the X and Y value always follow each other in my text file): X17.8Y-1. But this text can also be X16.1Y2.3 (the values will always be different after X and Y) I want to change it to this X17.8Y-1.G54 or X(value)Y(value)G54 My RegEx statement follows but it is not working. content = Regex.Replace(content, @"(X(?:\d*\.)?\d+)*(Y(?:\d*\.)?\d+)", "$1$2G54"); Can someone please modify it for me so it works and will search for X(wildcard) Y(Wildcard) and replace it with X(value)Y(value)G54? Thanks, Shawn

    Read the article

  • Find and Replace RegEx question

    - by fraXis
    I am starting to get a grip on RegEx thanks to all the great help here on SO with my other questions. But I am still suck on this one: My code is: StreamReader reader = new StreamReader(fDialog.FileName.ToString()); string content = reader.ReadToEnd(); reader.Close(); I am reading in a text file and I want to search for this text and change it (the X and Y value always follow each other in my text file): X17.8Y-1. But this text can also be X16.1Y2.3 (the values will always be different after X and Y) I want to change it to this X17.8Y-1.G54 or X(value)Y(value)G54 My RegEx statement follows but it is not working. content = Regex.Replace(content, @"(X(?:\d*\.)?\d+)*(Y(?:\d*\.)?\d+)", "$1$2G54"); Can someone please modify it for me so it works and will search for X(wildcard) Y(Wildcard) and replace it with X(value)Y(value)G54?

    Read the article

  • PHP replace backslash

    - by Skyfe
    Hi there, Been struggling with replacing a backslash by another symbol such as '.-.' just to indicate the position of backslashes as I could not send a string such as 'C\xampp\etc.' through url as GET variable so I thought I'd first replace the backslashes in that string by another symbol, then send through url, and then replace them back to backslashes in the PHP file that handles it. Though would there be a better way to send such strings through url? Because when I try a script such as: $tmp_name = preg_replace("\", ".-.", $_FILES['uploadfile']['tmp_name']); It turns out into a php error as \ is also used as delimiter.. Could anyone help me out on this? Thanks in advanced! Btw, if I'd be able to send a full array through url, this whole problem would be solved, but I don't think it's possible?

    Read the article

  • C#, string replace russian to english

    - by Fabio Beoni
    Hello, I have a strange problem replacing chars in string... I read a .txt file containing russian text, and starting from a list of letters russian to english (ru=en), I loop the list and I WOULD like to replace russian characters with english characters. The problem is: I can see in the debug the right reading of the russian and the right reading of the english, but using myWord = myWord.Replace(ruChar, enChar), the string is not replaced. My txt file is a UTF-8 encoding. Any suggestions?? Thank you to all...

    Read the article

  • How do I save a macro consisting of multiple search and replace into my .vimrc

    - by Doppelganger
    I have a macro that I use to replace special characters for its html entities. I would like to save it in my .vimrc. According to this, I should use let @r=' *macro_text_goes_here* '. The problem is that my macro is a series of search and replace, something like this: :%s:á:\&aacute;:Ige :%s:é:\&eacute;:Ige :%s:í:\&iacute;:Ige So, I've tried with ^V-enter, <enter>, <CR> using real line breaks, but it never works. On the other side, if I put the text on a register and then run the macro, it works as expected.

    Read the article

  • Replace text in div when image is clicked

    - by Adam
    Hello, I'm trying to replace certain text inside the div "info" when an image (which serve as links) is clicked. I'm just unsure of what methods could do this. I would prefer this be jquery. My code so far looks like: <div class="info"> <p>I would like this text replaced</p> <script> </script> </div><!--end info--> <li><a href="1.jpg"><img src="1-s.png" width="55" height="55" alt="" class="latest_img" /></a><p>Replace the div "info" text with the text here when clicked on</p></li>

    Read the article

  • Help with Perl Regex Recursive Replace One Liner? Replace MySQL comments '--' with '#'

    - by NJTechie
    I have various SQL files with '--' comments and we migrated to the latest version of MySQL and it hates these comments. I want to replace -- with #. I am looking for a recursive, inplace replace one-liner. This is what I have : perl -p -i -e 's/--/# /g' `fgrep -- -- * ` A sample .sql file : use myDB; --did you get an error I get the following error : Unrecognized switch: --did (-h will show valid options). p.s : fgrep skipping 2 dashes was just discussed here if you are interested. Any help is appreciated.

    Read the article

  • Replace text in string with delimeters using Regex

    - by user1057735
    I have a string something like, string str = "(50%silicon +20%!(20%Gold + 80%Silver)| + 30%Alumnium)"; I need a Regular Expression which would Replace the contents in between ! and | with an empty string. The result should be (50%silicon +20% + 30%Alumnium). If the string contains something like (with nested delimiters): string str = "(50%silicon +20%!(80%Gold + 80%Silver + 20%!(20%Iron + 80%Silver)|)| + 30%Alumnium)"; The result should be (50%silicon +20% + 30%Alumnium) - ignoring the nested delimiters. I've tried the following Regex, but it doesn't ignore the nesting: Regex.Replace(str , @"!.+?\|", "", RegexOptions.IgnoreCase);

    Read the article

  • Access VBA remove CR & LF only from the beginning of a text string by searching for them

    - by uZI
    Hi there I need to remove line breaks from the beginning of a memo type records. I dont want to use the replace function as it would remove all line breaks from the record which is not desired. Its only the line breaks at the beginning of the field that I am interested in removing. Furthermore, the my records do not always begin with a line break so I cant really use text positioning, the solution would be to look for line break at the beginning instead of always expecting it at the beginning. click here for a sample of what my data looks like any help will be greatly appreciated

    Read the article

  • JQuery slideToggle replace image src

    - by Rob
    Hi, This function is called when an up/down arrow is clicked to slide hidden div. If the div is hidden, the arrow points down and changes to up when the div is shown. If the div is shown, the arrow points up to hide div and changes to down when the div is closed. I just wanted to know if there was a more efficient way of doing this or if this is the correct way. Thanks. function showInfo(info_id) { var img_id = '#arrow_'+info_id; var div = '#info_'+appointment_id; $(div).slideToggle('normal',function() { if ($(this).is(':visible')) { $(img_id).attr('src',$(img_id).attr('src').replace('_down','_up')); } else { $(img_id).attr('src',$(img_id).attr('src').replace('_up','_down')); } });}

    Read the article

  • Create a new output file in ant replace task

    - by Sathish
    Ant replace task does a in-place replacement without creating a new file. The below snippet replaces tokens in any of the *.xml files with the corresponding values from my.properties file. <replace dir="${projects.prj.dir}/config" replacefilterfile="${projects.prj.dir}/my.properties" includes="*.xml" summary="true"/'> I want those *.xml files that had their tokens replaced be created as *.xml.filtered (for e.g.) and still have the original *.xml. Is this possible in Ant with some smart combination of tasks and concepts ?

    Read the article

  • Find and replace text in a string using C#

    - by Joey Morani
    Anyone know how I would find & replace text in a string? Basically I have two strings: string firstS = "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDABQODxIPDRQSERIXFhQYHzMhHxwcHz8tLyUzSkFOTUlBSEZSXHZkUldvWEZIZoxob3p9hIWET2ORm4+AmnaBhH//2wBDARYXFx8bHzwhITx/VEhUf39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3//"; string secondS = "abcdefg2wBDABQODxIPDRQSERIXFh/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/abcdefg"; I want to search firstS to see if it contains any sequence of characters that's in secondS and then replace it. It also needs to be replaced with the number of replaced characters in squared brackets: [NUMBER-OF-CHARACTERS-REPLACED] For example, because firstS and secondS both contain "2wBDABQODxIPDRQSERIXFh" and "/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/" they would need to be replaced. So then firstS becomes: string firstS = "/9j/4AAQSkZJRgABAQEAYABgAAD/[22]QYHzMhHxwcHz8tLyUzSkFOTUlBSEZSXHZkUldvWEZIZoxob3p9hIWET2ORm4+AmnaBhH//2wBDARYXFx8bHzwhITx/VEhUf39[61]f3//"; Hope that makes sense. I think I could do this with Regex, but I don't like the inefficiency of it. Does anyone know of another, faster way?

    Read the article

  • Javascript string.replace with regex

    - by Jimbo
    I want to replace a url querystring parameter with a new value if it already exists or add it on if not. e.g. The current url could be: a. www.mysite.com/whatever.asp?page=5&version=1 OR b. www.mysite.com/whatever.asp?version=1 I need the resulting url to be www.mysite.com/whatever.asp?page=1&version=1 I suspect I can use string.replace with a regex to do this the most intelligent way but am hoping for a little help with it from someone more experienced with regexs :) Thanks!

    Read the article

  • Javascript or jquery replace text

    - by ngreenwood6
    I need to replace some text that is on the page within the body tag. I am using javascript but have jquery available if needed. I basically need to replace test® (test with the registered trademark) with TEST® or tests® with TESTS® and it could even be test with TEST® or tests with TESTS®. I am able to uppercase them but its not liking to work for me with the ® sign, it wants to put duplicates on ones that already have it. Basically anything on the page that has the word test or tests should be TEST® or TESTS® if it is plural. Any help is appreciated.

    Read the article

  • Replace html tag with a certain class

    - by fire
    I am looking for suitable replacement code that allows me replace the content inside of any HTML tag that has a certain class e.g. $class = "blah"; $content = "new content"; $html = '<div class="blah">hello world</div>'; // code to replace, $html now looks like: // <div class="blah">new content</div> Bare in mind that: It wont necessarily be a div, it could be <h2 class="blah"> The class can have more than one class and still needs to be replaced e.g. <div class="foo blah green">hello world</div> I am thinking regular expressions should be able to do this, if not I am open to other suggestions such as using the DOM class (although I would rather avoid this if possible because it has to be PHP4 compatible).

    Read the article

  • Javascript search and replace sequence of characters that contain square brackets

    - by Ruth
    Hello all I'm trying to search for '[EN]' in the string 'Nationality [EN] [ESP]', I want to remove this from the string so I'm using a replace method, code examaple below var str = 'Nationality [EN] [ESP]'; var find = "[EN]"; var regex = new RegExp(find, "g"); alert(str.replace(regex, '')); Since [EN] is identified as a character set this will output the string 'Nationality [] [ESP]' but I want to remove the square brackets aswell. I thought that I could escape them using \ but it didn't work Any advice would be much appreciated

    Read the article

  • PHP str_replace and preg_replace work on one server but not another

    - by retailevolved
    I have a simple function on a php page that takes a url such as: http://myurl.com/mypage.html?param1=value1 and converts it to: http://myurl.com/searchpage.html?param1=value1 All it does it swap out the page.html portion. To do this, I use the following: $currentUrl = $this-getCurrentUrl(); // Grabs the current url, i.e 'http://myurl.com/mypage.html?param1=value1' // Derive a search pattern from the current url $pattern = "/" . str_replace(array("/", ".", "-"), array("\\/", "\\.", "\\-"), $currentUrl) . "/"; // get rid of the 'mypage.html' $newUrl = preg_replace($pattern, 'http://myurl.com/', $currentUrl); // replace the question mark with the correct page $newUrl = str_replace("/?", "/searchpage.html?", $newUrl); The above code is not the exact code but is a good representation. It works beautifully on one server, but when I push to production, the preg_replace does not work. I originally attempted to use str_replace. It also works on my local development machine, but not on the production server. I have confirmed that the URL variables are coming in correctly. Any ideas?

    Read the article

  • Replacing values using preg_replace

    - by Jeepstone
    I have a Joomla plugin (not important in this context), which is designed to take an input with a load of numbers (within a paragraph of text) and replace them with a series of s. My problem is that I need to do a preg_replace on my $article-text, but I don't know how to then apply the changes to the matched terms. I've seen the preg_replace_callback, but I don't know how I can call that within a function. function onPrepareContent( &$article, &$params, $limitstart ) { global $mainframe; // define the regular expression $pattern = "#{lotterynumbers}(.*?){/lotterynumbers}#s"; if(isset($article->text)){ preg_match($pattern, $article->text, $matches); $numbers = explode("," , $matches[1]); foreach ($numbers as $number) { echo "<div class='number'><span>" . $number . "</span></div>"; } }else{ $article->text = 'No numbers'; } return true; } AMENDED CODE: function onPrepareContent( &$article, &$params, $limitstart ) { global $mainframe; // define the regular expression $pattern = "#{lotterynumbers}(.*?){/lotterynumbers}#s"; if(isset($article->text)){ preg_match($pattern, $article->text, $matches); $numbers = explode("," , $matches[1]); foreach ($numbers as $number) { $numberlist[] = "<div class='number'><span>" . $number . "</span></div>"; } $numberlist = implode("", $numberlist); $article->text = preg_replace($pattern, $numberlist, $article->text); }else{ $article->text = 'No numbers'; } return true; }

    Read the article

  • C# Find and Replace RegEx with wildcard search and addition of value

    - by fraXis
    Hello, The below code is from my other questions that I have asked here on SO. Everyone has been so helpful and I almost have a grasp with regards to RegEx but I ran into another hurdle. This is what I basically need to do in a nutshell. I need to take this line that is in a text file that I load into my content variable: X17.8Y-1.Z0.1G0H1E1 I need to do a wildcard search for the X value, Y value, Z value, and H value. When I am done, I need this written back to my text file (I know how to create the text file so that is not the problem). X17.8Y-1.G54G0T2 G43Z0.1H1M08 I have code that the kind users here have given me, except I need to create the T value at the end of the first line, and use the value from the H and increment it by 1 for the T value. For example: X17.8Y-1.Z0.1G0H5E1 would translate as: X17.8Y-1.G54G0T6 G43Z0.1H5M08 The T value is 6 because the H value is 5. I have code that does everything (does two RegEx functions and separates the line of code into two new lines and adds some new G values). But I don't know how to add the T value back into the first line and increment it by 1 of the H value. Here is my code: StreamReader reader = new StreamReader(fDialog.FileName.ToString()); string content = reader.ReadToEnd(); reader.Close(); content = Regex.Replace(content, @"X[-\d.]+Y[-\d.]+", "$0G54G0"); content = Regex.Replace(content, @"(Z(?:\d*\.)?\d+)[^H]*G0(H(?:\d*\.)?\d+)\w*", "\nG43$1$2M08"); //This must be created on a new line This code works great at taking: X17.8Y-1.Z0.1G0H5E1 and turning it into: X17.8Y-1.G54G0 G43Z0.1H5M08 but I need it turned into this: X17.8Y-1.G54G0T6 G43Z0.1H5M08 (notice the T value is added to the first line, which is the H value +1 (T = H + 1). Can someone please modify my RegEx statement so I can do this automatically? I tried to combine my two RegEx statements into one line but I failed miserably. Thanks so much, Shawn

    Read the article

  • Find and Replace RegEx with wildcard search and addition of value

    - by fraXis
    The below code is from my other questions that I have asked here on SO. Everyone has been so helpful and I almost have a grasp with regards to RegEx but I ran into another hurdle. This is what I basically need to do in a nutshell. I need to take this line that is in a text file that I load into my content variable: X17.8Y-1.Z0.1G0H1E1 I need to do a wildcard search for the X value, Y value, Z value, and H value. When I am done, I need this written back to my text file (I know how to create the text file so that is not the problem). X17.8Y-1.G54G0T2 G43Z0.1H1M08 I have code that the kind users here have given me, except I need to create the T value at the end of the first line, and use the value from the H and increment it by 1 for the T value. For example: X17.8Y-1.Z0.1G0H5E1 would translate as: X17.8Y-1.G54G0T6 G43Z0.1H5M08 The T value is 6 because the H value is 5. I have code that does everything (does two RegEx functions and separates the line of code into two new lines and adds some new G values). But I don't know how to add the T value back into the first line and increment it by 1 of the H value. Here is my code: StreamReader reader = new StreamReader(fDialog.FileName.ToString()); string content = reader.ReadToEnd(); reader.Close(); content = Regex.Replace(content, @"X[-\d.]+Y[-\d.]+", "$0G54G0"); content = Regex.Replace(content, @"(Z(?:\d*\.)?\d+)[^H]*G0(H(?:\d*\.)?\d+)\w*", "\nG43$1$2M08"); //This must be created on a new line This code works great at taking: X17.8Y-1.Z0.1G0H5E1 and turning it into: X17.8Y-1.G54G0 G43Z0.1H5M08 but I need it turned into this: X17.8Y-1.G54G0T6 G43Z0.1H5M08 (notice the T value is added to the first line, which is the H value +1 (T = H + 1). Can someone please modify my RegEx statement so I can do this automatically? I tried to combine my two RegEx statements into one line but I failed miserably.

    Read the article

  • Find & Replace - using a Regex for this?

    - by Jack W-H
    Hey folks. Regexs make me cry, so, I came here for help. I'm looking for some tips on Find & Replace in Panic's Coda. I know the F&R is pretty advance but I'm just looking for the best way to do this. I'm trying to rewrite a 'template engine' (very basic) I have going on with a webapp I'm coding in PHP (CodeIgniter). Currently I'm calling my template like so: $this->load->view('subviews/template/headerview'); $this->load->view('subviews/template/menuview'); $this->load->view('subviews/template/sidebar'); $this->load->view('The-View-I-Want-To-Load'); // This is the important line $this->load->view('subviews/template/footerview'); However it's inefficient using five lines of code every time I want to load up a different page, in every different controller. So I rewrote it like this: $data['view'] = 'The-View-I-Want-To-Load'; $this->load->view('template',$data); That way if I need to make any major changes to the design it can easily be done from the template.php view file (which contains the header, menu, sidebar views etc. etc.). However I use the previous 5-lines all over the place in many different controllers and functions. So, my question is --- How can I find and replace the old template engine (5 lines of code) for the new one - substituting in the name of the view in the important, unique line for the one in $data['view]? Does that make any sense?! If not I'll try and rephrase! I mean, is there a way of doing this via a Regex or something? Or am I on completely the wrong lines here? Thanks for your help Jack

    Read the article

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