expression

regular expression format url

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 18:55:12
问题 need help to write regular expression to take change urls from: http://vermon.com/good/helping.html NOTE: good may change at times to something different to: http://suresite.com/helping.html PLEASE NOTE: I am changing the base url and taking out the word good 回答1: You could try with Java: System.out.println( "http://vermon.com/good/helping.html" .replaceAll("(http://)[^/]+/good(/.+)", "$1suresite.com$2")); Output: http://suresite.com/helping.html 来源: https://stackoverflow.com/questions

preg_match to match substring of three numbers consecutively?

天大地大妈咪最大 提交于 2019-12-25 18:39:52
问题 I have a string $text_arr="101104105106109111112113114116117120122123124" fairly big string If i want to split three numbers from them like 101,104,105 and store them in $array .What should i do? I tried doing this: preg_match_all('/[0-9]{3}$/',"$text_arr",$array); 回答1: The easiest way to do this is with preg_split()Docs: $result = preg_split('/(\d{3})/', $str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); See it working, or the result: Array ( [0] => 101 [1] => 104 [2] => 105 [3] =>

notepad++ select text until catch a specifc character

好久不见. 提交于 2019-12-25 18:25:05
问题 I have a text like this ROW0_ccTag=AA+AA&ysco=45aa&ROW0_ccHandle=123456789123& I want to select those _ccTag=AA+AA& _ccHandle=123456789123& I tried this expression \_ccTag\=.+ but it's selecting the whole text until the last & I want to select until the first & catch 回答1: You have to have an end point and the lazy operator: \_ccTag\=.+?\& https://regex101.com/r/jY3qN7/1 回答2: Give this a try (included an | alternate match): \_ccTag=.+?\&|\_ccHandle\=.+?\& 来源: https://stackoverflow.com

Aesthetics must be either length 1 or the same as the data (1)

女生的网名这么多〃 提交于 2019-12-25 08:59:24
问题 I am trying to mix annotate and expression statements in ggplot2. I'm getting a consistent error "Aesthetics must be either length 1 or the same as the data (1)". My first thought was that I had the wrong number of variables in aes. That might still be true, but I couldn't wrap my head around fixing it. So I searched and found errors and solutions that didn't seem to address the underlying problem. Here's my code: r2.val <- .09 pl <- qplot(c(0,30)) pl+annotate(geom="text",x=0,y=28,label=

DB2 v8 insert with CTE

时光怂恿深爱的人放手 提交于 2019-12-25 07:59:24
问题 I need to select from a CTE (common table expression) in DB2 v8 and insert the result into a table. The relevant documentation for v8 is hard to understand at first glance, but for v9 there's a clear example (http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.apsg/db2z_createcte.htm): INSERT INTO vital_mgr (mgrno) WITH VITALDEPT (deptno, se_count) AS ( SELECT deptno, count(*) FROM DSN8910.EMP WHERE job = 'senior engineer' GROUP BY deptno ) SELECT d

regex search a string for contents between two strings

拥有回忆 提交于 2019-12-25 05:04:28
问题 I am trying my upmost best to get my head around regex, however not having too much luck. I am trying to search within a string for text, I know how the string starts, and i know how the string ends, I want to return ALL the text inbetween the string including the start and end. Start search = [{"lx": End search = }] i.e [{"lx": variablehere }] So far I have tried /^\[\{"lx":(*?)\}\]/; and /(\[\{"lx":)(*)(\}\])/; But to no real avail... can anyone assist? Many thanks 回答1: You're probably

Expression-tree to build sub-select results

自古美人都是妖i 提交于 2019-12-25 05:03:15
问题 I'm trying to build a sub-query by using expression-trees. In linq I would write something like: var single = MyTable .AsExpandable() .Select(c => new { Childs = Enumerable.Select( MyTable.VisibleChilds.Invoke(c, dbContext), cc => Convert(cfg.ChildsConfig).Invoke(dbContext, cc)) }); where the Convert is building an expression like p => new MyTableSelect { Id = p.Id, Name = p.Name } depending on the given values from the config (to only read needed data from database). but I'm struggeling with

i<=: Expression is not complete; more tokens expected. ksh

北战南征 提交于 2019-12-25 04:13:14
问题 i get this error: i<=: Expression is not complete; more tokens expected. This is the code: vr=`$line` set sep_mx=`echo $vr | awk '{ n=split($0,x,"@#;") print n }'` echo $sep_mx i=1 && while ((i<=$sep_mx)) do echo $vr | awk -v er=$i '{ n=split($0,x,"@#;") print x[er] }' ((i+=1)) done Anyone can help me? Thanks 回答1: To answer the original question, the error message already explains where the error occurs: In i<= in i<=: Expression is not complete; more tokens expected. is the result of the

How to decompose expression to satisfy generic property change method?

天涯浪子 提交于 2019-12-25 03:41:14
问题 I have a base EF entity class which implements INotifyPropertyChanged . The base property, Id is my example: /// <summary> /// Entity Id /// </summary> public int Id { get { return id; } set { SetValue<int>(() => (Id != value), (v) => id = v); } // < can this be simplified into a single call? } ...where SetValue is defined: protected void SetValue<TValue>(Expression<Func<bool>> evalExpr, Action<TValue> set) { // Compile() returns a Func<bool> var doSetValue = evalExpr.Compile(); if

Prefix expression to evaluate multiple expressions simultaneously

只谈情不闲聊 提交于 2019-12-25 03:37:17
问题 private class InputListener implements ActionListener { public void actionPerformed(ActionEvent e) { Stack<Integer> operandStack = new Stack<Integer>(); Stack<Character> operatorStack = new Stack<Character>(); String input = inputTextField.getText(); StringTokenizer strToken = new StringTokenizer(input, " ", false); while (strToken.hasMoreTokens()) { String i = strToken.nextToken(); int operand; char operator; try { operand = Integer.parseInt(i); operandStack.push(operand); } catch