I got text like: do[A]and[B]  I want to extract all words that are wrapped by [ and ]. I am using the match method:    var text = "do[A]and[B]"; var regexp = /\[(\w+)\]/g; var result = text.match(regexp);   So I am saying that I want to match all words wrapped by [ ], but only the wrapped part should be in group/memory. I keep getting the [ ] parentheses in result:  ["[A]", "[B]"]   expected result is:  ["A","B"]   I thought this is a piece of cake to do, but I must be missing something.
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.
exponentiation of cardinal number Is it feasible to transform each variable differently while doing multiple regression I have a dataset with 10 variables ...is it feasible to transform each variable differently while doing multiple regression...  for example new_V1 = log(v1)  New_V2= V2^2  New_V3= 1/V3  Likewise differently for different variables and then applying multiple regression? I need some help in relation to this exercise    "Prove that if a normal subgroup $H$ of $ G$ has index $n$, then $g^n \in H$ for all $g \in G$."  I'm not allowed to use quotient groups in the proof, because the exercise is in the chapter before.   I tried by induction on $n$. The case $n=1,n=2$ are obvious, but even  the case $n=3$ is giving me trouble so I give up studying the general case of the inductive step.  My other approach was studying left or right coset of $G$. But I only proved that if $g \in aH$ then $g^2 \notin aH$ if $a \notin H$, and I can't find a way to demonstrate that $g^n \in H$. (my starting idea was to prove that every power of $g$ is in a different coset but then I realize that in this way I don't handle several case, for example $g$ has period strictly lesser than $n$ and in conclusion it doesn't prove the exercise)  Maybe I'm missing something about indexes, and this is why I asked here for some help,  (I can't use quotient groups because they are introduced later than this exercise, forgot to add this info in the beginning) Thanks in advance :) Err 80 appears when I turn on my Canon EOS 5D Mark II Recently when on holiday in Italy my 5DII stopped powering up. Turn the switch on and - nada. Pulling the battery and popping it back in brings the camera to life, however as soon as the camera goes in to sleep mode, or I turn the power off, the problem returns. Sometimes the camera shows Error 80 at this point:     Err 80      Shooting is not possible due to an error.    Turn the camera off and on again or re-install the battery.   I've seen various posts on the interwebs about pulling the clock battery and leaving the camera for a while - have tried this and also replaced the clock battery to no avail.   Has anyone else had this problem - did the body have to go back to Canon for repair or did you manage to fix it? Do not give the impression that all votes are unanimously in favor of the winning close-reason. I closed for "belongs on superuser," yet SO claims I closed for a completely different reason.  Source: I was reading a review of 5e game play  from our RSS Feed. And in it he makes an observation about a strange rule:     Weird rule thing. You recover half your level in hit dice during a   long rest, which means level 1 characters never recover hit dice.   That didn't make sense to me, and so I double checked the long rest rule and it reads:     At the end of a long rest, a character regains all lost it points.   The  character also regains spent Hit Dice, up to a number of dice   equal to half of the character’s total number of them. For example, if   a  character has eight Hit Dice, he or she can regain four spent Hit   Dice upon finishing a long rest.   And of course the rules state that in general you always round down.  Am I missing something? Is there a good explanation for why at first level you can't recover hitdice? Today I saw a sentence:  She surely can do it.  What does that mean? How does it differ from:  She certainly can do it. Surely she can do it.  This slight difference in meaning of those sentences I am not able to notice. Could you please help me? Thanks in advance! $\forall x,y>0, x^x+y^y \geq x^y + y^x$ Prove that $\forall x,y&gt;0, x^x+y^y \geq x^y + y^x$   A friend of mine told me none of the teachers in my school have succeeded in proving this seemingly simple inequality (it was asked at an oral exam last year). I tried it myself, but I made no significant progress. Does English have any singularia tantum besides mass nouns? I wasn't aware of a difference, but a coworker says there is, although he can't back it up. What's the difference if any? Books or resources for learning unified view of classical statistics? I did a science PhD doing applied bayesian statistics, and I liked it so much that I decided to shift to statistics.  For the last 2-3 years have been working at a firm that has more of a frequentist focus.  It seems to me that the bayesian approach (at least what I learned) has an underlying theory that was laid out and I could understand.  Now I find this - more classical - field fascinating but I am looking for some resources to get a unified view of the matter.  For example, I am learning and applying anovas, F-tests and chi-squares, thinking about degrees of freedom, etc but part of me is looking for deeper understanding that would make it more than just methods.  Does anyone have any suggestions on books or more resources that provide such a unified, deeper focus? How do I create a dynamic key to be added to a JavaScript object variable What is this lock screen with ads and how do I remove it? I think my device got a malware. A lock screen with ads sometimes appear, and I must swipe an area at the bottom of the screen to open the phone. I am in Eastern Europe, some ads are in Slavic languages, and they are seemingly related to travel.    Image resized. Click to view the full image  I have seen ads for Lot Air (Polish carrier). I recently went to their site.  Considering my recent surfing activity and the nature of the ads, I guess the malware is connected to airlines active in Eastern Europe.  The lock screen also promotes the app "DU Quick Charger" by claiming it has recharged the phone extra fast during screen off. (!?) It also shows battery level. I have never installed DU Quick Charger. I doubt DU Quick Charger is installed on the phone.  The problem started after installing Ryanair app. The problem is maybe, but not surely, related to this. Uninstalling Ryanair and restarting the phone doesn't remove the occasional appearance of this lock screen. After a while the situation has changed for the worse, now this lock screen appears after EVERY screen off.  I have always used Avast. I am not rooted and only install via Google Play.  What is this? And how do I remove it? I have just started learning Japanese Mahjong and I am a bit lost as to why this hand failed.  I did several pons and chis over the course of a hand, having a total of three open melds (one set and two sequences).  Apart from these I had an incomplete bamboo sequence of II and III as well as a pair of dragons, therefore I was on a single wait for I or IV bamboo stick tile. When the IV tile appeared in one of the discards of other players, I was given a choice to do another chi and declare another open meld, but I couldn't win with a ron. Why was that?  Am I wrong that winning by ron guarantees a single needed yaku to win a hand, just like Closed Tsumo does?  After declaring the chi I was offered with, my hand was left with a single pair of tiles, one of which I had to discard.  Eventually the round finished with a draw.  Why couldn't I win this hand with a ron on the IV bamboo tile, and why was I given only the choice of chi instead? Why crontab scripts are not working? Often, crontab scripts are not executed on schedule or as expected. There are numerous reasons for that:   wrong crontab notation permissions problem environment variables   This community wiki aims to aggregate the top reasons for crontab scripts not being executed as expected. Write each reason in a separate answer.  Please include one reason per answer - details about why it's not executed - and fix(es) for that one reason.  Please write only cron-specific issues, e.g. commands that execute as expected from the shell but execute erroneously by cron. Top Down RPG Movement w/ Correction? I would hope that we have all played Zelda: A Link to the Past, please correct me if I'm wrong, but I want to emulate that kind of 2D, top-down character movement with a touch of correction. It has been done in other games, but I feel this reference would be the easiest to relate to.  More specifically the kind of movement and correction I'm talking about is:   Floating movement not restricted to tile based movement like Pokemon and other games where one tap of the movement pad moves you one square in that cardinal direction. This floating movement should be able to achieve diagonal motion. If you're walking West and you come to a wall that is diagonal in a North East/South West fashion, you are corrected into a South West movement even if you continue holding left (West) on the controller. This should work for both diagonals correcting in both directions. If you're a few pixels off from walking squarely into a door or hallway, you are corrected into walking through the hall or down the hallway, i.e. bumping into the corner causes you to be pushed into the hall/door.   I've hunted for efficient ways to achieve this and have had no luck. To be clear I'm talking about the human character's movement, not an NPC's movement. Are their resources available on this kind of movement? Equations or algorithms explained on a wiki or something?  I'm using the XNA Framework, is there anything in it to help with this? I have a collection that contains linked assets. I would like to override their materials and give them a unique material. Is it possible to assign a material to a whole collection, and how ?  Thanks ! No matter how I do it, I always end up with $x = 0, 90, 270$ and $360$. All of those except $270$ is right, but I can't quite figure out how to get the $270$ degrees out of the answer. I've tried using trig identities, I've tried squaring both sides, but I always end up with $$2\sin x\cos x$$ which then leads me to $x = 0, 90, 270, 360$. But $$\sin (270) + \cos (270) = -1$$ so I'm doing something wrong. Why does the co-efficent of kinetic friction of a block on an inclined plane not change when you increase the angle of the plane? System log full of session and slice messages