Search Results

Search found 53464 results on 2139 pages for 'find and replace'.

Page 63/2139 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Extract and replace named group regex

    - by user557670
    I was able to extract href value of anchors in an html string. Now, what I want to achieve is extract the href value and replace this value with a new GUID. I need to return both the replaced html string and list of extracted href value and it's corresponding GUID. Thanks in advance. My existing code is like: Dim sPattern As String = "<a[^>]*href\s*=\s*((\""(?<URL>[^\""]*)\"")|(\'(?<URL>[^\']*)\')|(?<URL>[^\s]* ))" Dim matches As MatchCollection = Regex.Matches(html, sPattern, RegexOptions.IgnoreCase Or RegexOptions.IgnorePatternWhitespace) If Not IsNothing(matches) AndAlso matches.Count > 0 Then Dim urls As List(Of String) = New List(Of String) For Each m As Match In matches urls.Add(m.Groups("URL").Value) Next End If Sample HTML string: <html><body><a title="http://www.google.com" href="http://www.google.com">http://www.google.com</a><br /><a href="http://www.yahoo.com">http://www.yahoo.com</a><br /><a title="http://www.apple.com" href="http://www.apple.com">Apple</a></body></html>

    Read the article

  • How do I disable Hot Code Replace in Eclipse

    - by Xa6faiph
    HCR is failing alot more often than not for me at the moment. It keeps popping up the "Hot Code Replace Failed" dialog, over and over and over. I know there is a checkbox to shut it up, but later on when I'm doing something else I actually want the dialog to appear. Plus I don't want hot swapping code right now anyways, I just want the debugger. So is there a setting someplace for that "do not show dialog again" checkbox, for when I want to re-enable it? Better yet, is there a way to turn HCR on and off period? BTW, as far as I can tell disabling "Build Automatically" doesn't disable it.

    Read the article

  • Removing most inline styles and properties with PHP

    - by bakkelun
    This question is related to a similar case, namely http://stackoverflow.com/questions/2488950/removing-inline-styles-using-php The solution there does not remove i.e: <font face="Tahoma" size="4"> But let's say I have a mixed bag of inline styles and properties, like this: <ul style="padding: 5px; margin: 5px;"> <li style="padding: 2px;"><div style="border:2px solid green;">Some text</div></li> <li style="padding: 2px;"><font face="arial,helvetica,sans-serif" size="2">Some text</font></li> <li style="padding: 2px;"><font face="arial,helvetica,sans-serif" size="2">Some text</font></li> </ul> What regExp is needed to achieve this result? <ul> <li><div>Some text</div></li> <li><font>Some text</font></li> <li><font>Some text</font></li> </ul> Thanks for reading the question, any help is appreciated.

    Read the article

  • How to escape $ in php using preg_replace ?

    - by sakura
    Hi, I am using preg_replace to escape special characters... $tmpStr=preg_replace("/\?/", "\?", $tmpStr); $tmpStr=preg_replace("/\#/", "\#", $tmpStr); $tmpStr=preg_replace("/\^/", "\^", $tmpStr); $tmpStr=preg_replace("/\&/", "\&", $tmpStr); $tmpStr=preg_replace("/\*/", "\*", $tmpStr); $tmpStr=preg_replace("/\(/", "\(", $tmpStr); $tmpStr=preg_replace("/\)/", "\)", $tmpStr); $tmpStr=preg_replace("/\//", "\/", $tmpStr); but i am not able to escape $ using the same function $tmpStr=preg_replace("/\$/", "\$", $tmpStr); and also when i use the above statement all the spaces get replaced by $ and $ is not getting escaped....someone please help me with this....

    Read the article

  • is it possible to combine will_paginate with find_by_sql?

    - by Tam
    In my rails application I want to use will_paginate plugin to paginate on my query. Is that possible? I tried doing something like this but it didn't work: @users = User.find_by_sql(" SELECT u.id, u.first_name, u.last_name, CASE WHEN r.user_accepted =1 AND (r.friend_accepted =0 || r.friend_accepted IS NULL) .........").paginate( :page => @page, :per_page => @per_page, :conditions => conditions_hash, :order => 'first_name ASC') If not, can you recommend a way around this or a way that might work as I don't want to write my own pagination.

    Read the article

  • Substring a text since the target founded

    - by user580463
    I have a search on my php page and it is ok. With my search result, I highlighted the string target on my content. $search_tag_text = @preg_replace("/($mysearch)/i", "<u style=\"color:red\">$1</u>", $row->txtContent); Ok, but is it possible, after having found a string target on my content, to show 20 words before and 20 words after, instead listing all my content? Any help will be appreciated.

    Read the article

  • Using jQuery find string A or B and replace based on css class and ID

    - by Jason
    Using jQuery, how do you check for and replace the occurrence of stringA or stringB when it falls under a specific css class and ID? stringA = " | " stringB = "|" css = .login #bav <p id="nav"> <a href="#">oh ya</a> | <a href="#" title="Password Lost and Found"></a> </p> I have variations of this: jQuery(document).ready(function($) { $(".login #nav").replaceText( /testA|testB/gi, "fooBar" ); }); });

    Read the article

  • Replace multible data codes in a datafram with names

    - by Shabana
    I have a problem in replacing codes in a dataframe of 3890 observations. My dataframe has a character variable df$IJN which contains values from 1 to 27. I would like to replace these with meaningful data as follow If(1 OR 6 OR 10 OR 14 OR 18 OR 22 OR 26) should be replaced with UL. If(3 OR 7 OR 11 OR 15 OR 19 OR 23 OR 27) should be replaced with LL. If(4 OR 8 OR 12 OR 16 OR 20 OR 24) should be replaced with UR. If(5 OR 9 OR 13 OR 17 OR 21 OR 25) should be replaced with LR. (U,L,R,and L Refer to Upper, Lower, Right, and Left sites in the order) I thought of a for() with if() could not manage with it Also thought of df[which(df=="27")] ="LL" may work one by one not sure! Any help please. R v3.1 - Windows 7 E-H Shabana, Paris.

    Read the article

  • regular expression on replace method of js not working

    - by user950146
    why this is not working var value = arr[row][col].replace(new RegExp('"', 'g'),'""'); Error : Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0) Timestamp: Tue, 10 Apr 2012 11:22:01 UTC Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Note: : Error copied directly from debugger of IE8

    Read the article

  • Help constructing query - Compare columns and replace numbers

    - by Tommy
    I have a feeling that this query is pretty easy to construct, I just can't figure it out. I want to replace all numbers in table X column C, with numbers in table Z column A, where numbers from table X column C matches numbers in table Z column B. I hope that makes sense. Perhaps a little background information will make it clearer. I've converted from one CMS to another, and the module I used to convert mapped the ids to the new database. Table X column A is the new id's. Table X column B is the old id's. Table Z is the table for an image gallery that I migrated, and column C contains the id's of the images owners. Can anyone crack this nut?

    Read the article

  • Replace special characters in python

    - by Marcos Placona
    Hi, I have some text coming from the web as such: £6.49 Obviously I would like this to be displayed as: £6.49 I have tried the following so far: s = url['title'] s = s.encode('utf8') s = s.replace(u'Â','') And a few variants on this (after finding it on this very same forum) But still no luck as I keep getting: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 100: ordinal not in range(128) Could anyone help me getting this right? UPDATE: Adding the reppr examples and content type u'Star Trek XI &#xA3;3.99' u'Oscar Winners Best Pictures Box Set \xc2\xa36.49' Content-Type: text/html; charset=utf-8 Thanks in advance

    Read the article

  • Safe ASCII char to replace whitespace before storing

    - by AngryWhenHungry
    My code passes a big bunch of text data to a legacy lib, which is responsible for storing it. However, it tends to remove trailing whitespace. This is a problem when I read the data back. Since I cannot change the legacy code, I thought about replacing the all spaces with some uncommon ASCII character. When I read back the text, I can replace them back. Is this a bad idea, considering that I cannot touch the legacy storage code? Which character can I use as a substitute? I was considering some char upwards of 180. There will only be spaces - no tabs or newlines - in the data. The data is alphanumeric, with special characters.

    Read the article

  • Batch to copy and replace a txt file from one server to another

    - by Sunny
    I have two servers, server1 and server2 on same network but require username and password to be mapped. server1 has a text file as C:\Users\output.txt. I want to create and schedule a batch script on server1, which should copy and replace output.txt file from server1 to server2 at path E:\data\output.txt on daily basis. I don't want to map server2 manually every time I start my computer nor do I want to enter my username and password each time. I am using following commands in a batch, but not working; net use C: \\server2\E:\data server2password /user:server2domain\server2username /savecred /p:yes xcopy C:\Users\output.txt E:\data\

    Read the article

  • Replace String pattern in Java

    - by Hirantha
    I have the following string "value=\"\\d{4}((((0[1-9])|(1[0-2]))((0[1-9])|([12]\\d)|(3[01]))?)?|(\\-(((0[1-9])|(1[0-2]))(\\-((0[1-9])|([12]\\d)|(3[01])))?)?)?)d{4}" There I want to replace all the occurrences of "{" with NCHAR(0x7B) "}" with NCHAR(0x7D). An the content in-between "{ }" should remain unchanged: Ex: \\d{4} after replacing -> NCHAR(0x7B) 4 NCHAR(0x7D). Is there a way to do this using Regular Expressions in Java?. Anyway, this can be done processing the whole string using string operations.

    Read the article

  • replace asp.net Response.Output with my own content

    - by WebDude
    I am trying to intercept a asp.net web request and based on a lookup replace the page thats going to be rendered to the client. example: is a request for "/about-us" comes to my web server, i will first see if i have a version of this in the database, otherwise i will revert to flat files. The version i will retrieve from the database will be a .aspx page that has to be rendered and containt web controls and inline serverside script. What is the best way to go about this? I have tried overriding the CreateHtmlTextWriter method but this seems too late in the process as the TextWriter passed to this method is already instantiated. I have also tried to Implement my own PageHandlerFactory but this seems to create an instance of Page of which i cannot seem to override its internal setting of the Response.Output stream. Amd i barking up the wrong tree here? what is the best approach to take here?

    Read the article

  • Replace <Unknown Source> in Java Rhino (JSR223) with actual file name

    - by Lord.Quackstar
    Hello everyone, In my code, all of the scripts are contained in .js files. Whenever one of the scripts contains an error, I get this: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "nonexistant" is not defined. (<Unknown source>#5) in <Unknown source> at line number 5 What bugs me is the <Unknown Source>. Multiple files are in one ScriptContext, and it can be hard to track down an error. It also looks horrible. Is there a way to replace <Unknown Source> with the actual file name? None of the methods I see support passing a File object, so I'm really confused here.

    Read the article

  • Rails: find_by, conserving leading whitespaces

    - by peppermonkey
    Hi, when I do the following def somefunction @texts = A.find_all_by_someid(someid) respond_to do |format| format.xml { render :xml => @texts } end end it gets the string from the db correctly, except if the string has leading whitespaces, it seems they are trimmed. Note: the whitespaces are there in the db correctly What can I do to conserve those whitespaces? Thanks

    Read the article

  • Replacing Text in a Toggled Anchor with JQuery

    - by willmcneilly
    Hi I'm trying to change the text in an anchor on toggle. I'm doing this way at the moment but have found that once the anchor markup has replaced the toggle no longer works. Can someone please explain why this is happening and a solution? Many thanks. $('a#toggleHeader').toggle(function() { $('#header-wrapper').slideUp(); $(this).replaceWith('< href=\"#\" id="toggleHeader">Show Header</>'); //Note:I've move the anchor because I can only post one anchor as a new user },function(){ $('#header-wrapper').slideDown(); $(this).replaceWith('<a href=\"#\" id="toggleHeader">Hide Header</a>'); });

    Read the article

  • str_replace between two numerical strings

    - by user330840
    Another problem with str_replace, I would like to change the following $title data into URL by taking the $string between number in the beginning and after dash (-) Chicago's Public Schools - $10.3M New Jersey - $3M Michigan: Public Health - $1M The desire output is: chicago-public-school new-jersey michigan-public-health PHP code I am using $title = ucwords(strtolower(strip_tags(str_replace("1: ","",$title)))); $x=1; while($x <= 10) { $title = ucwords(strtolower(strip_tags(str_replace("$x: ","",$title)))); $x++; } $link = preg_replace('/[<>()!#?:.$%\^&=+~`*&#233;"\']/', '',$title); $money = str_replace(" ","-",$link); $link = explode(" - ",$link); $link = preg_replace(" (\(.*?\))", "", $link[0]); $amount = preg_replace(" (\(.*?\))", "", $link[1]); $code_entities_match = array( '&#39;s' ,'&quot;' ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,')' ,'+' ,'{' ,'}' ,'|' ,':' ,'"' ,'<' ,'>' ,'?' ,'[' ,']' ,'' ,';' ,"'" ,',' ,'.' ,'_' ,'/' ,'*' ,'+' ,'~' ,'`' ,'=' ,' ' ,'---' ,'--','--'); $code_entities_replace = array('' ,'-' ,'-' ,'' ,'' ,'' ,'-' ,'-' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'-' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'-' ,'' ,'-' ,'-' ,'' ,'' ,'' ,'' ,'' ,'-' ,'-' ,'-','-'); $link = str_replace($code_entities_match, $code_entities_replace, $link); $link = strtolower($link); Unfortunately the result I got: -chicagoamp9s-public-school 2-new-jersey 3-michigan-public-health Anyone has a better solution for this? Thanks guys! (the &#39; changed into amp9 - wonder why?)

    Read the article

  • css to replace characters in paragraph tag

    - by Thariama
    Already checked exisitng questions for this, but didn't find an exact match. My aim is to replace characters (like spaces) on a webpage with a small image using css. Example: <p><span>This is a text</span></p> becomes: <p><span>ThisIMGisIMGaIMGtext</span></p> (where IMG stands for a visible image (middot-pic for a space f.e.)) I cannot think of a suitable css selector. But myabe one of you guys (or girls) know a solution. Is this possible at all?

    Read the article

  • Replace the callback for a GtkItem created from a GtkItemFactoryEntry

    - by rampion
    I'm writing a plugin that's modifying an existing UI. One thing I want to do is change what an existing menu item does. This is all using the Gtk library. The menu item (a GtkItem) is created from a GtkItemFactoryEntry (which is out of my control), and has its current behaviour defined by the callback in the GtkItemFactoryEntry. I can get handle on the menu item using gtk_item_factory_get_widget() and attach further actions to the menu item using gtk_signal_connect(), but I can't seem to disconnect the original callback using gtk_signal_disconnect() or gtk_signal_disconnect_by_func(). Is there any way I can remove or replace the original callback?

    Read the article

  • C# Replace two specific commas in a string with many commas

    - by Hal
    I am trying to change the date format in each line from commas to hyphens. The index of the comma separating the month and day day and year varies. lines_in_List[i] = lines_in_List[i].Insert(0, cnt + ","); // Insert Draw # in 1st column string one_line = lines_in_List[i]; // 0,5,1,2012,1,10,19,16,6,36,,, // 1,11,5,2012,49,35,23,37,38,28,,, // 2,12,10,2012,8,52,53,54,47,15,,, // ^-^--^ replace the ',' with a '-'. StringBuilder changed = new StringBuilder(one_line); changed[3] = '-'; changed[5] = '-'; changed[3] = '-'; lines_in_List[i] = changed.ToString(); }

    Read the article

  • replace \n and \r\n with <br /> in java

    - by Bala R
    This has been asked several times for several languages but I can't get it to work. I have a string like this String str = "This is a string.\nThis is a long string."; And I'm trying to replace the \n with <br /> using str = str.replaceAll("(\r\n|\n)", "<br />"); but the \n is not getting replaced. I tried to use this RegEx Tool to verify and I see the same result. The input string does not have a match for "(\r\n|\n)". What am i doing wrong ?

    Read the article

  • jQuery: Replace strings with .each()

    - by Warrantica
    I want a function that replace each li with an image. This is my code: $(document).ready(function(){ var tmphref; var tmpname; var str = '<a href="' + tmphref + '"><img src="http://www.somesite.com/a/' + tmpname[1] + '/avatar-small.jpg /></a>'; $('#somediv li a').each(function(){ tmphref = $(this).attr("href"); tmpname = /http\:\/\/(\w+)\.somesite\.com\//.exec(tmphref); $(this).parent().replaceWith(str); }); }); The image is in this specific path: www.somesite.com/a/username/avatar-small.jpg The code above doesn't work. Any ideas? Thank you in advance.

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >