replace

MSAccess using a wildcard in the REPLACE function

主宰稳场 提交于 2019-12-31 05:42:29
问题 I'm trying to do something simple and I don't understand why it's not working. I'm really new to MS Access VBA. I have a string in a textbox : \\p9990cdc\C$\Temp I want to turn it into : C:\Temp I'm trying : strSelectedFile = Replace(strSelectedFile, "\\*\C$", "C:") and it's not working. Not sure why RegEx doesn't work either : strSelectedFile = Replace(strSelectedFile, "\\[\w]\C$", "C:") Everything is set properly so the problem lies exactly in that replace code, because if I try for example

Getting rid of files from domain name using PHP

拥有回忆 提交于 2019-12-31 05:33:26
问题 I have the following URLs: http://website.com/folder1/file.php http://website.com/folder2/file.html I want to know if there is any way in PHP that will let me hide the files and their extensions so the URLs will look like this: http://website.com/folder1/ http://website.com/folder2/ I know this is possible using htaccess and mod_rewrite but I want to do it using PHP only. 回答1: ok I found the answer : <? echo dirname("http://website.com/folder1/file.php"); ?> so the url will look like this :

Javascript for replacing an abreviation by his equivalent

怎甘沉沦 提交于 2019-12-31 05:09:27
问题 I met some trouble with a javascript. In fact I have in my database many records that are abreviations and ther equivalent, for example, replace tel => telephone etc... So I have this function $('#tags').keyup(function(e){ var code = e.which ? e.which : e.keyCode; console.log(code); if (code == 'tel'){ var input = this.value; input = input.substr(0, input.length -1); console.log(input); input += 'tel'; this.value = input; } }); Actualy this does not work the trouble is that I do not have aby

Save image to server from a URL

依然范特西╮ 提交于 2019-12-31 04:21:22
问题 I've built a mini-content management system with CKEditor. The user has the ability to paste an image URL from another website. Is there a way to to get all image URLs when the user submits the content, save all these images to the server, and replace another server's URL with URL of my server? For example, the user wrote something like this: <img src="somews.com/img1.jpg"/>Lorem Ipsum is simply dummy text of the printing and typesetting industry. ... During the submit process PHP would save

Python combination with replacement

点点圈 提交于 2019-12-31 03:56:25
问题 Below is my code import itertools a = [1,2,3] for i in itertools.combination_with_replacement(a,3): print i Output (1, 1, 1),(1, 1, 2) (1, 1, 3),(1, 2, 2) (1, 2, 3),(1, 3, 3) (2, 2, 2),(2, 2, 3) (2, 3, 3),(3, 3, 3) Only 10 result is print out, but by formula, it should be 3^3 = 27 output. So may i know, how to get the other output? Sincerely thank for your time and suggestion. 回答1: You want cartesian product, not combinations. import itertools print list(itertools.product([1, 2, 3], repeat=3)

String function - replace instances of a character if they are between two other characters

不问归期 提交于 2019-12-31 03:05:08
问题 I ran a massive SQL query that I don't want to run again and saved the results as a csv. I am doing some processing in a C# console app that adds each record to a storage table. Unfortunately, I messed up and did not remove ','s from the results, and there are some objects serialized in JSON in this data which contain ','. I am already looping through all this data, and so that my columns correctly line up I would just like to temporarily convert ',' to say ';', but only if it is between

How to replace a pattern in one file, with the contents of another file, using sed?

余生颓废 提交于 2019-12-31 01:57:33
问题 Lets say I have fileA , with the contents Hello, this is some random text REPLACEHERE and some more random text and fileB with the contents stuff that goes into fileA, at that specific place How do I properly replace REPLACEHERE inside fileA , with the contents of fileB ? Exactly in that place, just as if I was doing a simple regex operation ? The closest I've got was sed -i '/REPLACEHERE/r fileB' fileA which only ends up appending fileB in the line after REPLACEHERE was found, and that's no

how to remove matched tags but leave content with JQuery

旧时模样 提交于 2019-12-31 00:57:10
问题 I have HTML like this: <div> <div class="a"> content1 </div> content 2 <div class="a"> <b>content 3</b> </div> </div> and I want to get rid of the div's of class="a" but leave their content. My initial attempt was: $("div.a").replaceWith($(this).html()); However this is undefined. How would you do this? 回答1: try $("div.a").each(function(){ $(this).replaceWith($(this).html()); }); 回答2: Replacing elements with their stringified HTML content will nuke any event handlers that might be in place.

随笔---真正的随笔

我们两清 提交于 2019-12-30 23:37:50
打开blog发现从上一篇文章发布的时间到现在已经近1个月了,时间的概念在这一刻变得这么可怕。。。为自己找点理由吧,这么久没更新是因为。。。好吧,真的不想找类似工作忙、情绪糟糕、没什么可写的诸如此类的理由。我果断检讨---我懒了。 猛然又意识到很多blog社区,包括这里--cnblog对blog的称呼很有意思--”随笔“。记得自己早先开始写BLOG的时候注意到这点时很不满,心说自己还想在这篇BOLG里大说一通呢,里面有很多”牛逼“的心得、”独家“的技术要点还要加上点“幽默”的笔触,怎么他们就这么不当回事呢?居然把我要发表的“大作”一笑带过的感觉,偏称之为“随笔”。如今google了一下-所谓“随笔”即是 随手笔录,抒情、叙事或评论不拘,篇幅短小。我想放在如今的BOLG里,“随笔”的意境可能还要更随便些,可大可小,可糙可精,可以是规定自己每天都写,可以是随心所欲有感才而发。“随笔”这词把BLOG的精髓诠释的凌厉精致。SO,我自己写BLOG也会更加“随笔”,提醒自己千千万万不要出现一个月没来写东西的情况了。虽然不会强制自己的频率,但话说一个月都无感来发岂不是人生过得很失败-_-!。。 结束自己的话唠吧。今天总结下最近写游戏服务器端设计数据库的一点心得---再次感慨数据库设计真是一门科学啊,什么技术都是越深入越探不到底。 MySQL 的 replace into 语句:

Python regex replace with ASCII value

China☆狼群 提交于 2019-12-30 17:29:12
问题 My input string is something like He#108##108#o and the output should be Hello . Basically I want to replace each #[0-9]+# with the relevant ASCII characters of the number inside the ## . 回答1: Use a replacement function in your regex, which extracts the digits, converts them to integer, and then to character: import re s = "He#108##108#o" print(re.sub("#(\d+)#", lambda x : chr(int(x.group(1))), s)) Result: Hello 回答2: You can use re.split() : import re s = "He#108##108#o" new_s = re.split("#+"