regex

Match all characters up until a word boundary

我的未来我决定 提交于 2021-02-10 19:10:08
问题 Based off Regex Until But Not Including, I'm trying to match all characters up until a word boundary. For example - matching apple in the following string: apple < I'm doing that using: a negated set [^] with a word boundary \b and a plus + repeater Like this: /a[^\b]+/ Which should look for an "a" and then grab one or more matches for any character that is not a word boundary. So I would expect it to stop before < which is at the end of the word Demo in Regexr Demo in StackSnippets var input

Is there a way regex will match all the combinations of the tokens in `|` operator

℡╲_俬逩灬. 提交于 2021-02-10 19:08:12
问题 I am doing a parser for nand2tetris project. I want to check if the destination field is either M|D|MD|A|AM|AD|AMD and their different ways of combinations like MA not only AM . ^(M|D|MD|A|AM|AD|AMD)\s*=$ This regex correctly matches AM= , but not MA= . I don't want to list out all the possible combinations of those tokens, is there a way to do it simply? 回答1: This should do it: ^(?=[MDA]+$)(?!.?(.).?\1).{1,3}$ Demo The negative lookahead attempts to match two "M" 's, two "D" 's or two "A" 's

Match all characters up until a word boundary

非 Y 不嫁゛ 提交于 2021-02-10 19:08:04
问题 Based off Regex Until But Not Including, I'm trying to match all characters up until a word boundary. For example - matching apple in the following string: apple < I'm doing that using: a negated set [^] with a word boundary \b and a plus + repeater Like this: /a[^\b]+/ Which should look for an "a" and then grab one or more matches for any character that is not a word boundary. So I would expect it to stop before < which is at the end of the word Demo in Regexr Demo in StackSnippets var input

Match all characters up until a word boundary

不羁岁月 提交于 2021-02-10 19:06:24
问题 Based off Regex Until But Not Including, I'm trying to match all characters up until a word boundary. For example - matching apple in the following string: apple < I'm doing that using: a negated set [^] with a word boundary \b and a plus + repeater Like this: /a[^\b]+/ Which should look for an "a" and then grab one or more matches for any character that is not a word boundary. So I would expect it to stop before < which is at the end of the word Demo in Regexr Demo in StackSnippets var input

Update query too slow on Postgres 9.1

旧时模样 提交于 2021-02-10 18:51:59
问题 My problem is that I have a very slow update query on a table with 14 million rows. I tried different things to tune my server which brought good performance but not for update queries. I have two tables: T1 with 4 columns and 3 indexes on it (530 rows) T2 with 15 columns and 3 indexes on it (14 millions rows) I want to update the field vid (type integer) in T2 by the same value of vid in T1 by joining the two tables on a text field stxt. Here is my query and its output: explain analyse

Importing CSV from URL that has line breaks within one of the fields

筅森魡賤 提交于 2021-02-10 18:44:42
问题 I created a script that imports a CSV file from a URL into a Google Sheet. I have used Utilities.parseCsv(csv) in the past with no problems. However, this particular CSV file contains a field that has multiple line returns (ALT+Enter). This causes the parsed file to create extra rows when it encounters these fields. I think the best approach is to sanitize the CSV file before parsing, but I do not know how to do this. The problem field is 'Description' (Column G). Current Script: function

Regematch if, and, and date combined forumula

醉酒当歌 提交于 2021-02-10 18:24:50
问题 I need help trying to figure out a combination google sheets formula If Cell B5 contains "Rct" And today's date is 30 days after the date defined in cell C5 And if Cell D5 and D6 both says "2 weeks ago" or "1 week ago" or contains the words "day" "hour" or "minute" (not sure if possible but instead of the all those words could if be if the text in cell D5 and D6 are the color "green" and or "Yellow") Then Cell H5 will say "Y" if the above conditions are met or "N" if they aren't The following

while (!scannerObject.hasNext(patternObject)) works for only one iteration

喜你入骨 提交于 2021-02-10 16:09:36
问题 The problem I only get one successful iteration from a while loop that is controlled by a hasNext(Pattern pattern) condition. I try to 'clear' the input stream (?) with .next() but unsuccessfully. The behaviour If I enter invalid input the first time, seemingly valid subsequent input continues to execute the System.out.print("You did not enter a valid size. Try again: ") line. But this line should only execute if Scanner getPizzaSize does not have valid input. If instead I enter valid input

while (!scannerObject.hasNext(patternObject)) works for only one iteration

China☆狼群 提交于 2021-02-10 16:08:37
问题 The problem I only get one successful iteration from a while loop that is controlled by a hasNext(Pattern pattern) condition. I try to 'clear' the input stream (?) with .next() but unsuccessfully. The behaviour If I enter invalid input the first time, seemingly valid subsequent input continues to execute the System.out.print("You did not enter a valid size. Try again: ") line. But this line should only execute if Scanner getPizzaSize does not have valid input. If instead I enter valid input

while (!scannerObject.hasNext(patternObject)) works for only one iteration

痴心易碎 提交于 2021-02-10 16:08:13
问题 The problem I only get one successful iteration from a while loop that is controlled by a hasNext(Pattern pattern) condition. I try to 'clear' the input stream (?) with .next() but unsuccessfully. The behaviour If I enter invalid input the first time, seemingly valid subsequent input continues to execute the System.out.print("You did not enter a valid size. Try again: ") line. But this line should only execute if Scanner getPizzaSize does not have valid input. If instead I enter valid input