regex

In delimited string replace substring between the delimiters only if the substring matches replacement value

◇◆丶佛笑我妖孽 提交于 2021-01-29 00:10:55
问题 I need to in a delimited string, replace substring between the delimiters only if the substring matches the replacement value Using this in Google sheets The matching var ifind = ["AA", "CaaL"]; var ireplace = ["zz", "Bob"]; zz replaces AA Bob replaces CaaL I have | Id | Segment | |----|--------------------| | 1 | AAA AA|AA|CaaL AA | | 2 | AAA-AA|AA|CaaL | | 3 | AAA, AA|AA|AA | | 4 | AA | | 5 | AA AA | | 6 | AA, AA | | 7 | | | 8 | CaaL | | 9 | AA | I need | Id | Segment | |----|--------------

In delimited string replace substring between the delimiters only if the substring matches replacement value

梦想与她 提交于 2021-01-29 00:04:51
问题 I need to in a delimited string, replace substring between the delimiters only if the substring matches the replacement value Using this in Google sheets The matching var ifind = ["AA", "CaaL"]; var ireplace = ["zz", "Bob"]; zz replaces AA Bob replaces CaaL I have | Id | Segment | |----|--------------------| | 1 | AAA AA|AA|CaaL AA | | 2 | AAA-AA|AA|CaaL | | 3 | AAA, AA|AA|AA | | 4 | AA | | 5 | AA AA | | 6 | AA, AA | | 7 | | | 8 | CaaL | | 9 | AA | I need | Id | Segment | |----|--------------

Pythonic script that ignores timestamps in log files

南笙酒味 提交于 2021-01-28 23:26:53
问题 There are 2 log files : log A and log B . log A 2015-07-12 08:50:33,904 [Collection-3]INFO app -Executing Scheduled job: System: choppa1 2015-07-12 09:56:45,060 [Collection-3] INFO app - Executing Scheduled job: System: choppa1 2015-07-12 10:00:00,001 [Analytics_Worker-1] INFO app - Trigger for job AnBuildAuthorizationJob was fired. 2015-07-12 11:00:00,007 [Analytics_Worker-1] INFO app - Starting the AnBuildAuthorizationJob job. log B 2014-07-12 09:50:33,904 [Collection-3] INFO app -

Regex Optional Match

烈酒焚心 提交于 2021-01-28 23:21:40
问题 I have this regex pattern which I made myself (I'm a noob though, and made it through following tutorials): ^([a-z0-9\p{Greek}].*)\s(Ε[0-9\p{Greek}]+|Θ)\s[\(]([a-z1-9\p{Greek}]+.*)[\)]\s-\s([a-z0-9\p{Greek}]+$) And I'm trying to match the following sentences: ΠΡΟΓΡΑΜΜΑΤΙΣΤΙΚΕΣ ΕΦΑΡΜ ΣΤΟ ΔΙΑΔΙΚΤΥΟ Ε2 (Ε.Β.Δ.) - ΔΗΜΗΤΡΙΟΥ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ 1 Θ (ΑΜΦ) - ΜΑΣΤΟΡΟΚΩΣΤΑΣ ΕΙΣΑΓΩΓΗ ΣΤΗΝ ΠΛΗΡΟΦΟΡΙΚΗ Θ (ΑΜΦ) - ΒΟΛΟΓΙΑΝΝΙΔΗΣ And so on. This pattern splits the string into 4 parts. For example, for the string

Lookbehind to get the text in R regex [duplicate]

只愿长相守 提交于 2021-01-28 23:05:47
问题 This question already has an answer here : Get more than 1 quotations in text paragraph in R regex (1 answer) Closed 5 years ago . I have data like this: Good afternoon. Hello. My bro's name is John... and he said softly 0.8% : "Don't you think I am handsome??" HAHA. jiji. koko. I would like to take get the sentence before the quotations, and text inside the quotation by using Look Behind regex in R. First: I want to look for quotation marks in a bunch of text. Second: Look back and extract 1

Lookbehind to get the text in R regex [duplicate]

£可爱£侵袭症+ 提交于 2021-01-28 22:51:40
问题 This question already has an answer here : Get more than 1 quotations in text paragraph in R regex (1 answer) Closed 5 years ago . I have data like this: Good afternoon. Hello. My bro's name is John... and he said softly 0.8% : "Don't you think I am handsome??" HAHA. jiji. koko. I would like to take get the sentence before the quotations, and text inside the quotation by using Look Behind regex in R. First: I want to look for quotation marks in a bunch of text. Second: Look back and extract 1

Pythonic script that ignores timestamps in log files

时光总嘲笑我的痴心妄想 提交于 2021-01-28 22:50:51
问题 There are 2 log files : log A and log B . log A 2015-07-12 08:50:33,904 [Collection-3]INFO app -Executing Scheduled job: System: choppa1 2015-07-12 09:56:45,060 [Collection-3] INFO app - Executing Scheduled job: System: choppa1 2015-07-12 10:00:00,001 [Analytics_Worker-1] INFO app - Trigger for job AnBuildAuthorizationJob was fired. 2015-07-12 11:00:00,007 [Analytics_Worker-1] INFO app - Starting the AnBuildAuthorizationJob job. log B 2014-07-12 09:50:33,904 [Collection-3] INFO app -

In delimited string replace substring between the delimiters only if the substring matches replacement value

左心房为你撑大大i 提交于 2021-01-28 22:39:33
问题 I need to in a delimited string, replace substring between the delimiters only if the substring matches the replacement value Using this in Google sheets The matching var ifind = ["AA", "CaaL"]; var ireplace = ["zz", "Bob"]; zz replaces AA Bob replaces CaaL I have | Id | Segment | |----|--------------------| | 1 | AAA AA|AA|CaaL AA | | 2 | AAA-AA|AA|CaaL | | 3 | AAA, AA|AA|AA | | 4 | AA | | 5 | AA AA | | 6 | AA, AA | | 7 | | | 8 | CaaL | | 9 | AA | I need | Id | Segment | |----|--------------

Regular expression to extract hashes from file

亡梦爱人 提交于 2021-01-28 22:34:40
问题 I have a file in this format: 5:Name: {"hash":"c602720140e907d715a9b90da493036f","start":"2016-02-20","end":"2016-03-04"} 5:Name: {"hash":"e319b125d71c62ffd3714b9b679d0624","sa_forum":"on","start":"2015-11-14","end":"2016-02-20"} I am trying to extract the hash key and date using a regular expression. How can I do it? I tried this /^[a-z0-9]{32}$/ for the hash but it doesn't work. I would appreciate some help. Edit: This is a text file, and I'm trying to preg_match() it. Here's my code: $file

Regex Optional Match

血红的双手。 提交于 2021-01-28 22:26:33
问题 I have this regex pattern which I made myself (I'm a noob though, and made it through following tutorials): ^([a-z0-9\p{Greek}].*)\s(Ε[0-9\p{Greek}]+|Θ)\s[\(]([a-z1-9\p{Greek}]+.*)[\)]\s-\s([a-z0-9\p{Greek}]+$) And I'm trying to match the following sentences: ΠΡΟΓΡΑΜΜΑΤΙΣΤΙΚΕΣ ΕΦΑΡΜ ΣΤΟ ΔΙΑΔΙΚΤΥΟ Ε2 (Ε.Β.Δ.) - ΔΗΜΗΤΡΙΟΥ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ 1 Θ (ΑΜΦ) - ΜΑΣΤΟΡΟΚΩΣΤΑΣ ΕΙΣΑΓΩΓΗ ΣΤΗΝ ΠΛΗΡΟΦΟΡΙΚΗ Θ (ΑΜΦ) - ΒΟΛΟΓΙΑΝΝΙΔΗΣ And so on. This pattern splits the string into 4 parts. For example, for the string