I'm building a parser for formulas, I'm having troubles with nested brackets, is there a simple regex to solve this kind of expressions considering an indefinite amount of nesting?  This is how the expression are composed:   If(Condition) Then { Action } Else { Action2 }   Example of expressions:  1: if (Category = 4) then {Validation(HB):Insert(COMNP)} else {Nothing}  2: if (Requested(INDP)) then {  if (Result(INDP) &gt; 70)  then {   DoNothing   }  else { MakeSomething } else { MakeSomethingElse }   Example of return:  1: if (Category = 4) then {return 1;} else {return 2;}  2: if (Requested(INDP)) then {  if (Result(INDP) &gt; 70)  then {   return 1; }  else { return 2; } else { return 3;}   With match arrays like this:  [1]: Validation(HB):Insert(COMNP)  [2]: Nothing  [1]: DoNothing  [2]: MakeSomething  [3]: MakeSomethingElse    My RegEx knowledge isn't strong but I know this is achievable in some way, I hope my post is easy to understand.   I need to isolate the actions between the deeper brackets and replace them with ordered numbers.
13063
Is it possible to write a regular expression that matches a nested pattern that occurs an unknown number of times? For example, can a regular expression match an opening and closing brace when there are an unknown number of open/close braces nested within the outer braces?  For example:  public MyMethod() {   if (test)   {     // More { }   }    // More { } } // End   Should match:  {   if (test)   {     // More { }   }    // More { } }
90864
I very rarely meet any other programmers!  My thought when I first saw the token was "implies that" since that's what it would read it as in a mathematical proof but that clearly isn't its sense.  So how do I say or read "=>" as in:-  IEnumerable&lt;Person&gt; Adults = people.Where(p =&gt; p.Age &gt; 16)   Or is there even an agreed way of saying it?
98928
Does anyone know how to make (nice looking) double bracket multiset notation in LaTeX. i.e something like (\binom{n}{k}) where there are two outer brackets instead of 1 as in binomial? You can see an example of what I mean in  under the heading "Multiset coefficients" with the double brackets.  In wikpedia they typset it as: \left(\!\!{n\choose k}\!\!\right) but although this works well for LaTeX in maths mode, with inline equations the outer bracket becomes much larger than the inner bracket.  I have also tried using \genfrac{((}{))}{0pt}{}{n}{k} but it has an error with the double brackets.  I am using \binom as well in my document, so I would like the bracket sizes to be similar for \binom and \multiset.  Thanks for any help. I'm surprised I can't find a solution on google.
83873
Is it possible to do something like this?  var pattern = /some regex segment/ + /* comment here */     /another segment/;   Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.
33704
I want to compose the results of two Linq Expressions. They exist in the form  Expression&lt;Func&lt;T, bool&gt;&gt;   So the two that I want to compose are essentially delegates on a parameter (of type T) that both return a boolean. The result I would like composed would be the logical evaluation of the booleans. I would probably implement it as an extension method so my syntax would be something like:  Expression&lt;Func&lt;User, bool&gt;&gt; expression1 = t =&gt; t.Name == "steve"; Expression&lt;Func&lt;User, bool&gt;&gt; expression2 = t =&gt; t.Age == 28; Expression&lt;Func&lt;User, bool&gt;&gt; composedExpression = expression1.And(expression2);   And later on in my code I want to evaluate the composed expression  var user = new User(); bool evaluated = composedExpression.Compile().Invoke(user);   I have poked around with a few different ideas but I fear that it is more complex than I had hoped. How is this done?
89914
Examples  I've recently found examples of using pairs of enclosing braces {}, with nothing in between the opening and closing braces, as arguments to commands and even to their options:  cat foo | xargs -I{} echo {}  find . -size 0 -exec rm -i {} \;  No Documentation  My problem is that I cannot find a documentation in the  that describes the usage of {} in such context as in the examples above.  I do not think it is a , because a dollar sign must precede the enclosing braces in a parameter expansion as in ${}.  It cannot be a  either, because it takes the form of {x..y[..incr]}, where x and y are not optional.  It also cannot be a  either, because {} is used as arguments.  Questions   What does a pair of enclosing braces {} even mean, in general, as an argument to any command that accepts it? Where can I find a documentation that describes the usage of {} as arguments?
64488
I am trying to parse url-encoded strings that are made up of key=value pairs separated by either &amp; or &amp;amp;.   The following will only match the first occurrence, breaking apart the keys and values into separate result elements:  var result = mystring.match(/(?:&amp;|&amp;amp;)?([^=]+)=([^&amp;]+)/)   The results for the string '1111342=Adam%20Franco&amp;348572=Bob%20Jones' would be:  ['1111342', 'Adam%20Franco']   Using the global flag, 'g', will match all occurrences, but only return the fully matched sub-strings, not the separated keys and values:  var result = mystring.match(/(?:&amp;|&amp;amp;)?([^=]+)=([^&amp;]+)/g)   The results for the string '1111342=Adam%20Franco&amp;348572=Bob%20Jones' would be:  ['1111342=Adam%20Franco', '&amp;348572=Bob%20Jones']   While I could split the string on &amp; and break apart each key/value pair individually, is there any way using JavaScript's regular expression support to match multiple occurrences of the pattern /(?:&amp;|&amp;amp;)?([^=]+)=([^&amp;]+)/ similar to PHP's preg_match_all() function?  I'm aiming for some way to get results with the sub-matches separated like:  [['1111342', '348572'], ['Adam%20Franco', 'Bob%20Jones']]   or   [['1111342', 'Adam%20Franco'], ['348572', 'Bob%20Jones']]
106039
For my thesis I need particular brackets for defining some operators. I found \llceil, \rrceil, \llfloor and \rrfloor in the , which are just what I was looking for. Unfortunately, they do not support \left and \right and therefore they look very ugly with tall formulas. Probably they are not designed for such formulas.  Is there a simple way to make them supporting \left and \right or to define other brackets that do support them?
15675
Is this just a bit of historical cruft left over from the 1950s or is there some reason syntactically why multi-expression bodies of (if) forms require (progn)? Why can't you wrap the multiple expressions in a set of parentheses like with (let):     (if some-cond      ((exp1) (exp2) (exp3)) ; multi exp "then"      (exp4)) ; single exp "else"   It appears it would be trivial to write a macro to test each body to see first if it is a list and then if it is, if its first element is also a list (and thus not a function invocation) and then to wrap its subcomponents inside a (progn) accordingly.
262
I don't really understand regular expressions.  Can you explain them to me in an easy-to-follow manner?  If there are any online tools or books, could you also link to them?
29686
I recently read somewhere that writing a regexp to match an email address, taking into account all the variations and possibilities of the standard is extremely hard and is significantly more complicated than what one would initially assume.  Can anyone provide some insight as to why that is?    Are there any known and proven regexps that actually do this fully?  What are some good alternatives to using regexps for matching email addresses?
10375
I have a very long equation that must be separated into two lines, and it has several pairs of nesting \left \right delimiters. Unfortunately, it seems that they need to be on the same line in order for them to work.  Also I'm using the align environment because I need the aligning functionality. Is there a way to have the size of delimiters automatically adjusted over multiple lines?
87647
I have a concern with nested quantifiers.  I have: $$  \forall x \exists y \forall z(x^2-y+z=0) $$ such that $$ x,y,z \in \Bbb Z^+$$   My first question, can it be read like this:  $$  \forall x \forall z \exists y(x^2-y+z=0)  $$  The way I did it, is I started off with $x=1, z=1 $   $$ 2-y = 0 $$ $$ y =2 $$  Is this a good approach?
71596
expr does not seem to like parenthesis (used in mathematics to explicit operator priority):  expr 3 * (2 + 1) bash: syntax error near unexpected token `('   How to express operator priority in bash?
10756
The TikZ-PGF manual is clear that for the matrix library, the delimiters are parentheses and braces:     Delimiters are parentheses or braces   to the left and right of a formula or   a matrix.   I would like to use brackets as delimiters for a matrix of math nodes. I have tried \left[ and \right] but they do not work.  Is there any way to get brackets as delimiters for a matrix of math nodes?  Thanks.
12967
How to type big \{ and \} braces in this sentence:  $$P_{n,k}=\{\{x,y\}\in [X]^2: n=\min \{m\in \omega: B_m(x)\cap B_m(y)=\emptyset\}; (x,y)\notin G_k\}$$   Could somebody help me?
2704
Obviously, you can use the | (pipe?) to represent OR, but is there a way to represent AND as well?  Specifically, I'd like to match paragraphs of text that contain ALL of a certain phrase, but in no particular order.