brackets

VB.NET Match string between parentheses (brackets)

試著忘記壹切 提交于 2019-12-02 02:03:07
Looking for a pattern for matching text between brackets. For example: "(this is) a (test)" should output "this is" "test" Using Dim m As Match = Regex.Match(str, pattern, RegexOptions.Multiline) I have searched stackOverflow, Google and tried examples on RegExr and nothing seems to work for me. These work on RegExr but in not VB.NET "\(([^)(]++|(?R))+\)" - error nested quantifier "(?<=\<p\>)(.*?)(?=<\/p\>)" - quantifier following nothing Others will return: "this is) a (test" - matching far outer brackets PS I could also do with the same for [],"",{} it would be good to have them all in one

Python: What does the use of [] mean here?

走远了吗. 提交于 2019-12-01 17:58:19
What is the difference in these two statements in python? var = foo.bar and var = [foo.bar] I think it is making var into a list containing foo.bar but I am unsure. Also if this is the behavior and foo.bar is already a list what do you get in each case? For example: if foo.bar = [1, 2] would I get this? var = foo.bar #[1, 2] and var = [foo.bar] #[[1,2]] where [1,2] is the first element in a multidimensional list [] is an empty list. [foo.bar] is creating a new list ( [] ) with foo.bar as the first item in the list, which can then be referenced by its index: var = [foo.bar] var[0] == foo.bar #

groovy array remove the brackets

自闭症网瘾萝莉.ら 提交于 2019-12-01 14:52:57
def colarray=[] def num def newRole = rolecol.split(',') def len = newRole.size() println "$newRole,$len" for (num = 0; num < len; num++) { def col = "col" col="$col"+newRole[num] colarray.add(col) } println colarray sql.eachRow("select col01,$colarray from read_csv where col01=? and col${usercol}!=? ", [file.name,""]) i want save col1..col11 into array and call it from select statement, but the problem is that $colarray has the brackets with it (like [col03, col04, col05, col06, col07, col08, col09, col10, col11, col12, col13, col14, col15, col16, col17, col18, col19, col20, col21, col22,

When do if constructs not require brackets?

蓝咒 提交于 2019-12-01 11:30:15
I'm doing some homework for a shell scripting class and had a question asking me to write a script that tests whether or not the argument entered is a valid shell variable name. The below script seems to work fine. if echo "$1" | grep -v ".*[^A-Za-z_]" > /dev/null then echo yes else echo no fi I understand brackets are short hand for the test function in the BASH shell. My problem is that, when I attempted the above script using brackets I got an error. if [ echo "$1" | grep -v ".*[^A-Za-z_]" > /dev/null ] The problem with this (I believe) is that grep is trying to use the ] as its argument,

How to replace square brackets with curly brackets using R's regex?

允我心安 提交于 2019-12-01 09:15:29
Due to conversions between pandoc-citeproc and latex I'd like to replace this [@Fotheringham1981] with this \cite{Fotheringham1981} . The issue with treating each bracket separately is illustrated in the reproducible example below. x <- c("[@Fotheringham1981]", "df[1,2]") x1 <- gsub("\\[@", "\\\\cite{", x) x2 <- gsub("\\]", "\\}", x1) x2[1] # good ## [1] "\\cite{Fotheringham1981}" x2[2] # bad ## [1] "df[1,2}" Seen a similar issue solved for C#, but not using R's perly regex - any ideas? Edit: It should be able to handle long documents, e.g. old_rmd <- "$p = \alpha e^{\beta d}$ [@Wilson1971]

Understanding list indexing and bracket conventions in R

安稳与你 提交于 2019-12-01 09:03:40
I almost understand list indices in R, but I have a few lingering questions. Specifically I am trying to understand using multiple indices to get to different layers of data in a list, and the types of brackets to use at each level with each data type. First I will show a simple example list and my understanding so far. #Make an example list "L" containing different types of data x<- matrix(1:12,3,4) y<- seq(2,17,3) z<- list(letters[1:5],LETTERS[1:5],letters[6:10],LETTERS[6:10]) L<- list(x,y,z) Top level of indexing: L is a list containing 3 elements, x, y, and z. To see an element in a list

Understanding list indexing and bracket conventions in R

萝らか妹 提交于 2019-12-01 07:03:59
问题 I almost understand list indices in R, but I have a few lingering questions. Specifically I am trying to understand using multiple indices to get to different layers of data in a list, and the types of brackets to use at each level with each data type. First I will show a simple example list and my understanding so far. #Make an example list "L" containing different types of data x<- matrix(1:12,3,4) y<- seq(2,17,3) z<- list(letters[1:5],LETTERS[1:5],letters[6:10],LETTERS[6:10]) L<- list(x,y

How to replace square brackets with curly brackets using R's regex?

别来无恙 提交于 2019-12-01 06:15:56
问题 Due to conversions between pandoc-citeproc and latex I'd like to replace this [@Fotheringham1981] with this \cite{Fotheringham1981} . The issue with treating each bracket separately is illustrated in the reproducible example below. x <- c("[@Fotheringham1981]", "df[1,2]") x1 <- gsub("\\[@", "\\\\cite{", x) x2 <- gsub("\\]", "\\}", x1) x2[1] # good ## [1] "\\cite{Fotheringham1981}" x2[2] # bad ## [1] "df[1,2}" Seen a similar issue solved for C#, but not using R's perly regex - any ideas? Edit:

what do the square brackets mean? in Java

白昼怎懂夜的黑 提交于 2019-11-30 20:18:51
What does it mean when their are square brackets in front of double . For example double[] and is there any special way to use the return function when using them in a method. For Example: public double[] MethodName(){ } What is the type of the return value? Square brackets [] would indicate an array. In your case of code: public double[] MethodName(){ .... } You have a public method MethodName which returns an array. Double indicates what type the array is, i.e. stores an array of objects of type double. EDIT: Forgot about answering your return question. But for your line of code, MethodName

How do i replace [] brackets using SED

霸气de小男生 提交于 2019-11-30 17:40:22
I have a string that i am want to remove punctuation from. I started with sed 's/[[:punct:]]/ /g' But i had problems on HP-UX not liking that all the time, and some times i would get a 0 and anything after a $ in my string would dissappear. So i decided to try to do it manually. I have the following code which works on all my punctuation that I am interested in, except I cannot seem to add square brackets "[]" to my sed with anything else, otherwise it does not replace anything, and i dont get an error, so I am not sure what to fix. Anyways this is what i currently have and would like to add [