Usage of this code is to show only the last four digits of an input.  Here I want to replace this "(/.(?=.{4})/g, '*')" '4' with variable 'mask' . Something like that.  x.value = x.value.replace(/.(?=.{+mask+})/g, '*');   Any suggestion plz    function myFunction(mask) {     var x = document.getElementById("cc");     x.value = x.value.replace(/.(?=.{4})/g, '*'); } &lt;input type="text" id="cc" onkeyup="myFunction(4)" style="text-align:right"&gt;
I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it.  However, I can't figure out how to pass a variable in to a regex.  I can do this already which will replace all the instances of "B" with "A".  "ABABAB".replace(/B/g, "A");   But I want to do something like this:  String.prototype.replaceAll = function(replaceThis, withThis) {     this.replace(/replaceThis/g, withThis); };   But obviously this will only replace the text "replaceThis"...so how do I pass this variable in to my regex string?
Definite integral, quotient of logarithm and polynomial: $I(\lambda)=\int_0^{\infty}\frac{\ln ^2x}{x^2+\lambda x+\lambda ^2}\text{d}x$ I was thinking this integral : $$I(\lambda)=\int_0^{\infty}\frac{\ln ^2x}{x^2+\lambda x+\lambda ^2}\text{d}x$$ What I do is use a Reciprocal subsitution, easy to show that: $$I(\lambda)=\int_0^{\infty}\frac{\ln ^2x}{\lambda ^2x^2+\lambda x+1}\text{d}x =\frac{1}{\lambda}\int_0^{\infty}\frac{(\ln x-\ln \lambda)^2}{x^2+x+1}\text{d}x \\ =\frac{\ln ^2\lambda}{\lambda}\int_0^{\infty}\frac{1}{x^2+x+1}\text{d}x+\frac{1}{\lambda}\int_0^{\infty}\frac{\ln ^2x}{x^2+x+1}\text{d}x \\ =\frac{\ln ^2\lambda}{\lambda}\frac{2\pi}{3\sqrt{3}}+\frac{2}{\lambda}\int_0^1\frac{\ln ^2x}{x^2+x+1}\text{d}x$$ But I hav no idea on process the remaining integral:( Anyone knows how to solve it?  THX guys! I came with another method might work for this: Recall the handy GF $$\frac{1}{x^2+x+1}=\frac{2}{\sqrt{3}}\sum_{k=0}^{\infty}\sin \left(\frac{2\pi}{3}\left(k+1\right)\right)x^k$$ Then we have :  $$\int_0^1\frac{\ln ^2x}{x^2+x+1}\text{d}x=\frac{2}{\sqrt{3}}\sum_{k=0}^{\infty}\frac{2}{\left(k+1\right)^3}\sin \left(\frac{2\pi}{3}\left(k+1\right)\right)x^k$$ With $$\sum_{k=1}^{\infty}\frac{\sin (kx)}{k^3}=\frac{\pi ^2}{6}x-\frac{\pi}{4}x^2+\frac{x^3}{12}$$ What can we arrived? I am doing an analysis with 2 groups of patients (control and disease) whose blood pressures have been measured continuously for 24 hours. My first goal is to test the effect of GROUP on BP. In the beginning, I built the mixed effect model with TIME as random effect variable and group as fixed effect model. The model I used is listed below:  mod &lt;- lme(BP ~ factor(GROUP), random=~1+ TIME| ID, data=gdata)   However, the experimenter wants to know the effects of GROUP on the slope of blood pressure changing per hour. In another words, we need to have blood pressure slope, which is the change of blood pressure by time, as response variable in the model. And I generated another model as bellow:  mod &lt;- lme(BP ~ factor(GROUP)*TIME, random=~1+ TIME| ID , data=gdata)   However, in the new model, the time works both as random effect variable and fixed effect variable. I am not sure if this is allowed in the mixed effect model. Show that $\sin(z) = z$ has infinitely many solutions in complex numbers. Little Picard theorem should help, but using big Picard theorem is undesirable. Thanks a lot! Should I delete my own questions with answers? I don't know much about this,  But I've some of the questions on which some user has answered (not helpful answer) also but I want to delete those questions, but whenever I go to delete that question. It is prompting with     What does it mean? Can someone tell me what would be the action taken by Stack Exchange if I delete more questions? Packed images used as background don't show up when reopening the file I am looking for a way to output all page IDs from the following menu:   &lt;?php wp_list_pages('depth=1&amp;exclude='3,5,11')); ?&gt;   Only top level pages needed, therefore the 'depth=1'.  Any help appreciated. What strategies, criteria, or rules to use for selecting coordinate systems? What strategies, criteria, or rules do you use for selecting coordinate systems for    (a) storing,  (b) analyzing, and  (c) displaying GIS data?     (I humbly offer  to a  about watershed analysis as an example of the considerations involved in (b).)  What are the pitfalls to watch out for?  Links to Web sites you find particularly helpful in this regard are welcome. Why doesn't current pass through a resistance if there is another path without resistance? Why doesn't current pass through a resistance if there is another path without resistance? How does it know there is resistance on that path? Some clarification:  I understand that some current will flow through the resistance. A depiction of this phenomenon through Ohm's laws does not answer the 'why' part of the question as it does not illuminate the process behind this phenomenon. There seems to be disagreement among the answers on whether the charge repulsions are enough to cause this effect. Cited research would be appreciated to resolve this issue. To refine what I mean by this question, I think I should give an example of why I am curious as to the causal background of this phenomenon. If charge repulsions do in fact repel 'current' in the example of the short circuit, then why does the same phenomenon not happen in other parallel circuits. (Again, I know that not all circuits behave ideally) I believe the question is expressed in the most straightforward way possible. This should, however, not affect the scope of the answers. I do not wish to see or think on the level of an electron as circuit behavior always includes a cumulative effect due to the nature of electrostatic interactions. Can I disable auto logon on windows 10 home I recently setup a new computer for my parents with windows 10 home. I made two local accounts for them - no microsoft accounts. I also would like to keep them without a password. Problem is now that windows automatically signs in with the last used account. No lock/login screen.  I tried a number of answers from similar questions here but none worked. Since it's a home version there are no group policies and the method using task scheduler does not work because accounts with no password are not allowed to create such tasks.  Are there other options to force windows to show a user list on startup without setting passwords for the accounts? Abstract, Interface, Classes OH MY - Question on Approach Let $a,b,c\in \Bbb R^+$ such that $(1+a+b+c)(1+\frac{1}{a}+\frac{1}{b}+\frac{1}{c})=16$. Find $(a+b+c)$ How to compute the following integral?  $$\int\log(\sin x)\,dx$$    Motivation: Since $\log(\sin x)'=\cot x$, the antiderivative $\int\log(\sin x)\,dx$ has the nice property $F''(x)=\cot x$. Can we find $F$ explicitly? Failing that, can we find the definite integral over one of intervals where $\log (\sin x)$ is defined? Difference between cp -r and cp -R (copy command) What happens if you miss a connecting flight? What is the best way to get a sine wave from a square wave? probability that there is at least one defective part In Terraria, is there an order in NPC appearance in addition to the minimum requirements for each one? I noticed a strange thing about Demolitionist that I do not see mentioned on .  Practically on my world I created immediately a good number of houses with  needed to accommodate an NPC.  The first NPC that arrived was the Nurse. Then I found many bombs but Demolitionist never came. He arrived just immediately  Merchant came, when I finally got the 50 silver coin needed for him.  Is this behavior correct? Is there and order in NPC appearance in addition to the minimum requirements for each one? Custom Post Type Archives by Year & Month? How do you display the archives of a Custom Post Type by Year &amp; Month? "Baggage" versus "luggage" We have a Barbarian on our team that very much likes to switch up his weapons; he goes from a Dwarven Hammer, to a pair of Hand-Axes, to occasionally just going bare-fisted. No issues there, he's fairly adept with all 3.  However, I have only just recently picked up on the way that he rolls his attacks for the two Hand-Axes: He rolls the first attack, adds his modifiers etc. Then he rolls the second attack, this time without modifiers, which is all well and good. But I'm not sure if this action uses his bonus action or not, or is considered a separate action (though, being a level 4 Barbarian, he only has one action per turn), or is merely part of the same action.  If we have a look at the Two-Weapon Fighting feature from the Fighter's fighting styles:     Two-Weapon Fighting   When you engage in two-weapon fighting, you can add your ability modifier to the damage of the second attack. (PHB5e p.72)   Similarly, the Dual Wielder feat also uses the Two-Weapon Fighting feat:     Dual Wielder   You master fighting with two weapons, gaining the following benefits:      ...         You can use two-weapon fighting even when the one-handed melee weapons you are wielding aren’t light. (PHB5e p.164, emphasis mine)      So; yes, this gives a bonus to the second weapon attack, but having asked a  to clarify which action this secondary weapon attack belongs to, it was determined that this uses your bonus action;     [...] the second attack requires a bonus action   So after that long winded explanation, here is the question: Without any additional feats, can you wield and use two weapons at once, and if so, how many actions does it require to make a full attack with both weapons in a turn?