replace

replacing pieces of string

帅比萌擦擦* 提交于 2020-01-11 10:18:06
问题 i'm doing something like excel, i have something like this: 1 2 3 A1 B1 C1 where it replaces the content for specified content, where A1 replaces the content for 1. B1 replaces the content of 2...and etc... i'm using a multidimensional array, and i do the things like this: int offset = 0, readCharCount; while(sscanf(matris[i][c] + offset, "%c%d%*c%n", &col, &linha, &readCharCount) == 2){ //printf("%c, %d\n", col, linha); //strcpy(matris[i][c], matris[linha-1][col - 'A']); offset +=

Replacing backslash with another symbol in PHP

倖福魔咒の 提交于 2020-01-11 09:51:34
问题 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 to exclude <a href='''></a> PHP

空扰寡人 提交于 2020-01-11 09:46:10
问题 Im using preg_replace to replace keywords in text with a href tag, my regex is working awesome, right now my code is: $newstring2 = preg_replace("/\p{L}*?".preg_quote($match[$i])."\p{L}*/ui", "<a href='".$url."' class='link'>$0</a>", $newstring); Only problem with this is, that I need to exclude any keywords inside <a href='https://keyword.cz' title="keyword">keyword</a> This is what I found https://stackoverflow.com/a/22821650/4928816 So is here someone who can help me merge this two regex

get string between other string vb.net

强颜欢笑 提交于 2020-01-11 09:37:10
问题 I have code below. How do I get strings inside brackets? Thank you. Dim tmpStr() As String Dim strSplit() As String Dim strReal As String Dim i As Integer strWord = "hello (string1) there how (string2) are you?" strSplit = Split(strWord, "(") strReal = strSplit(LBound(strSplit)) For i = 1 To UBound(strSplit) tmpStr = Split(strSplit(i), ")") strReal = strReal & tmpStr(UBound(tmpStr)) Next 回答1: Dim src As String = "hello (string1) there how (string2) are you?" Dim strs As New List(Of String)

MySQL regex replace?

試著忘記壹切 提交于 2020-01-11 09:15:07
问题 I've got a table with blob text fields. This blob has a lot of html in it. One of the pieces of html is an h2. I would like to find all instances of a word in the h2 tag, and replace it with another word (while leaving other words the same). For example, I would like to replace the h2 "wiggles" with "bumbles" in the following: Before: <h2>This is some wiggles html!</h2> <p>And here is some more wiggles html that could be ignored</p> <h2>And this is a decoy h2</h2> After: <h2>This is some

JQuery How to replace strings inside a textarea?

半腔热情 提交于 2020-01-11 07:50:14
问题 Current Textarea: <textarea id="event_content"> This text area could be full of information..www.london2012.com And might contain upto 5 links that all need updating. www.rio2016.org Link already converted. this should be left. <a href="http://www.thetimes.co.uk" target="_blank">www.thetimes.co.uk</a> </textarea> Desired Textarea after jquery: all links to be cleaned/replaced with tags and target attr <textarea id="event_content"> This text area could be full of information <a href="http:/

利用VBA来实现,输入日文之后,输出它的假名即读法

坚强是说给别人听的谎言 提交于 2020-01-11 07:43:55
背景:当你输日文汉字的额时候,输出它的读音。 如下图所示 实现的代码如下 Option Explicit ' Replace を まとめて おこなう Private Function ReplaceA(ByVal s As String, ByVal t1 As String, ByVal t2 As String) As String Dim u1() As String: u1 = Split(t1) Dim u2() As String: u2 = Split(t2) Dim i As Integer For i = 0 To UBound(u1) s = Replace(s, u1(i), u2(i)) Next ReplaceA = s End Function ' カタカナを ローマ字(英語式)に おきかえる Public Function KatakanaToRoomaziE(ByVal s As String) As String ' 前処理 s = ReplaceA(s, "ッン", "'ン") ' 拗音・特殊音 s = ReplaceA(s, "キャ キュ キョ", "kya kyu kyo") s = ReplaceA(s, "シャ シュ ショ", "sha shu sho") s = ReplaceA(s, "チャ チュ チョ", "cha chu cho"

How do you perform string replacement on just a subsection of a string?

混江龙づ霸主 提交于 2020-01-11 07:07:11
问题 I'd like an efficient method that would work something like this EDIT: Sorry I didn't put what I'd tried before. I updated the example now. // Method signature, Only replaces first instance or how many are specified in max public int MyReplace(ref string source,string org, string replace, int start, int max) { int ret = 0; int len = replace.Length; int olen = org.Length; for(int i = 0; i < max; i++) { // Find the next instance of the search string int x = source.IndexOf(org, ret + olen); if(x

Replace value in column with corresponding value from another column in same dataframe

眉间皱痕 提交于 2020-01-11 06:47:51
问题 Im trying to match a specific value in one column and replace it with the corresponding value from another column (same row). This is probably very easy... I have been trying to find a solution with for loop , sub , subset , data.table but I have not succeeded. There must be a neat way of doing this. Example data, where we aim at swapping a in the first column with the corresponding value in the second column and outputting the column again. df <- data.frame(rbind(c('a','D'),c('H','W'),c('Q',

How do I pass $SHELL variable into a perl search and replace

筅森魡賤 提交于 2020-01-11 06:32:08
问题 I have the following two commands : value=`grep -o Logs\/.*txt\" textFILE` perl -i -wpe's/" onclick="img=document\.getElementById\('\''img_1'\''\); img\.style\.display = \(img\.style\.display == '\''none'\'' \? '\''block'\'' : '\''none'\''\);return false"/$value/' textFILE However, I keep on getting a Use of uninitialized value $value in concatenation (.) or string at -e line 1, <> line 56. error. Can someone tell me what I am doing wrong. 回答1: For an example like the following: $ value=$