This regular expression: /\{(\w+)\}/g returns ["{name}", "{color}"] and ignores my parenthesis around (\w+)  Why doesn't this work? What is the correct regular expression?    Token replacement:  const item = {   name: 'foo',   color: 'bar' };  let str = `'{name} - {color}'`  console.log( str.match( /\{(\w+)\}/g ) );
I want to match a portion of a string using a  and then access that parenthesized substring:  var myString = "something format_abc"; // I want "abc"  var arr = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(myString);  console.log(arr);     // Prints: [" format_abc", "abc"] .. so far so good. console.log(arr[1]);  // Prints: undefined  (???) console.log(arr[0]);  // Prints: format_undefined (!!!)   What am I doing wrong?    I've discovered that there was nothing wrong with the regular expression code above: the actual string which I was testing against was this:  "date format_%A"   Reporting that "%A" is undefined seems a very strange behaviour, but it is not directly related to this question, so I've opened a new one, .    The issue was that console.log takes its parameters like a printf statement, and since the string I was logging ("%A") had a special value, it was trying to find the value of the next parameter.
I want to advance in the ranks of Senator Lavigny-Duval. How can I get merit points? I know I can participate in expansion goals, but is there a better way than that? I have a problem with the interpretation of a test result in which the p-value is 8.6e-28. How should it be interpreted? What is the e for?  Specifically, I used White's Test for the homoscedasticity assumption of a linear regression:  White's general test statistic :  150.0535  Chi-sq( 9)  P-value =  8.6e-28 What is the probability one card from each suit will be represented when 5 cards are dealt? If you run a code snippet, a hat still appears (hats are above snippets in the Z-order) How to print the position How to write the below lines using array?? val1=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $1}')    val2=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $2}')  val3=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $3}')  val4=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $4}')  Threadout.txt contains like &quot;Thread 1/1/25/100&quot; What is meant by a "random variable"? I have a big pot full of chicken necks and backs on the stove which I need to separate into (a) stock and (b) everything else.  I'm wondering the best way to go about doing this. I've previously laid cheesecloth into a fine-mesh strainer and poured it through that, but the cheesecloth always seems to kind of clog up, making straining 4 litres of stock a very lengthy process. I also tried a coffee filter laid inside a strainer and got more-or-less the same results.   Alternatively, I ditched the cheesecloth and just used the fine-mesh strainer by itself, but, unsurprisingly, this method leaves some bits I'd rather not have.   I'm wondering: is there a better way? Or should I stick with the cheesecloth and work on being more patient? After the last update of TeXLive 2018 (pretest) I get an error with csquotes' macro MakeAutoQuote:  \setcounter{errorcontextlines}{100} \listfiles \documentclass[fontsize=11pt,paper=a4,pagesize,ngerman]{scrartcl} \usepackage[utf8]{inputenc} \usepackage{babel} \usepackage[T1]{fontenc} \usepackage{csquotes} \MakeAutoQuote{»}{«}  \begin{document} ABC \end{document}   The error:  ! Package csquotes Error: Invalid argument.   My versions:  inputenc.sty    2018/04/06 v1.3b Input encoding file babel.sty    2018/02/14 3.18 The Babel package csquotes.sty    2018/02/11 v5.2c context-sensitive quotations (JAW)   I use pdfLaTeX. What is wrong here? VirtualBox 5.0.40 crashes the whole host since update to kernel 4.13.0-26-generic Calculus of variations -- how does it make sense to vary the position and the velocity independently? CSS3's border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners? How to request a random row in SQL? During the movie, we learned that Ego tried to reproduce the Celestial gene by having a lot of children and then having them delivered to him. I am not sure if Yondu was contracted for all of them but he definitely delivered at least a few of them since he broke the ravager code and got banned for dealing in kids.  My question is: why did he stop with Peter? Was Peter the last one on the contract or did he keep on delivering some but just not Peter?  Also, why didn't Ego seek out Yondu to get his kid back?  I don't think this was touched on in the movie. This was slightly mentioned here () but that is not answering my question.  I think Yondu said it was because he could get to places where the Ravagers could not since he was a kid but that would have been true with all the others kids he abducted for Ego. I need something explained or corrected:  In my number theory class we proved that there are an infinite number of primes using Euler's Phi Totient. It went something like this:  Let $M = p_1 p_2 \dots p_n$ be the product of all primes. Consider $1 &lt; A \le M$:  Some prime must divide $A$, call it $q$. Since $q$ must be one of the primes, $q$ must divide $M.$  So the $gcd(A,M) &gt; 1.$ Thus $\phi(M) = 1$ ...?   Which is not even and contradicts the theorem that $\phi(N)$ is even for $N&gt;2.$ Therefore there exists an infinite number of primes.  I get confused by the statement "Thus $\phi(M) = 1$"....  Did i possibly copy this proof down wrong? or am I missing something? Thank you in advance.   Edit: by consider a such that...i meant consider an integer '$a$' I replaced it with $A$ to hopefully make it more clear.   Edit2: I'm sorry I am not familiar with using the equation editor. This is not a homework assignment, just studying for my exam. I just want to be able to understand this or clearify it. Question about Casella and Berger's proof of MLE invariance In Casella and Berger, p. 320, they have a proof of the invariance of the MLE. Let $g: \theta \mapsto \eta$ be a function. They define the induced likelihood as  $$ L^*(\eta \mid X) = \sup_{\{\theta: g(\theta) = \eta\}} L(\theta \mid X). $$  This ensures that $g$ is one-to-one with respect to the likelihood functions because if $g$ is not one-to-one, there may be multiple values of $\theta$ that map to a given $g(\theta) = \eta$.  Then they note  $$ \sup_{\eta} L^*(\eta \mid X) = \sup_{\eta} \sup_{\{\theta: g(\theta) = \eta\}} L(\theta \mid X) = \sup_{\theta} L(\theta \mid X). $$  The first equality just applies the definition of the MLE of $\eta$. However, the next inequality confuses me. They write,     The second inequality follows because the iterated maximization is equal to the unconditional maximization over $\theta$...   Can someone justify this claim or provide some intuition if the claim is supposed to obviously follow from definitions? How to create a grain / noise effect in Adobe Illustrator I want to create a noise effect using Adobe Illustrator.  Inside the hexagonal shape there is some kind of texture effect, I don't know what the name of this effect is:    How can I create such an effect in Adobe Illustrator? or is it created using Photoshop? How to properly install Microsoft Office in Ubuntu 14.04 with wine? I have been trying to install it many times using the Wine version avaliable from the Sofware Center. Is there a proper way to configure it for allowing the installtion? Show a matrix in detail Below it is a very useful command to create a matrix. But it has a short point to me since it shows Parentheses not Square brackets. My question it how should I change this to show square brackets? I appreciate your answer. Thank you so much.  \[ K =   \underbracket{\begin{pmatrix}    K_1 &amp; 0      &amp; 0    \\    0   &amp; \ddots &amp;    0   \\    0   &amp; 0      &amp; K_n    \\    \end{pmatrix}}_{d\times M} \] Does the VBA "And" operator evaluate the second argument when the first is false? Update: Now that it's 2016 I'd use PowerShell for this unless there's a really compelling backwards-compatible reason for it, particularly because of the regional settings issue with using date. See @npocmaka's     What's a Windows command line statement(s) I can use to get the current datetime in a format that I can put into a filename?  I want to have a .bat file that zips up a directory into an archive with the current date and time as part of the name, for example, Code_2008-10-14_2257.zip. Is there any easy way I can do this, independent of the regional settings of the machine?  I don't really mind about the date format, ideally it'd be yyyy-mm-dd, but anything simple is fine.  So far I've got this, which on my machine gives me Tue_10_14_2008_230050_91:  rem Get the datetime in a format that can go in a filename. set _my_datetime=%date%_%time% set _my_datetime=%_my_datetime: =_% set _my_datetime=%_my_datetime::=% set _my_datetime=%_my_datetime:/=_% set _my_datetime=%_my_datetime:.=_%  rem Now use the timestamp by in a new ZIP file name. "d:\Program Files\7-Zip\7z.exe" a -r Code_%_my_datetime%.zip Code   I can live with this, but it seems a bit clunky. Ideally it'd be briefer and have the format mentioned earlier.  I'm using Windows Server 2003 and Windows&nbsp;XP Professional. I don't want to install additional utilities to achieve this (although I realise there are some that will do nice date formatting).