I'm looking to replace everything in between a set of parentheses in java using the replaceAll() method. The problem I'm running into is that in between the set of parentheses are another set so it looks like the following: (stuff here (more stuff) and more stuff) and using the regular expression: \\(.*?\\) doesn't work because it ends up only replacing part of it because of the nested parentheses. Any suggestions on a regex I could use to replace everything?
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 { } }
How can I return NULL from a generic method in C#? When writing a book and referring to a female and male aged 18–25, what term would be most appropriate? Boy and girl seem too young, whereas man and woman seem too old.  Example sentence:     A boy/man emerged from the shadows.   Edit: I think the word I am looking for is similar to 'guy' but less American and colloquial. Any thoughts? How to avoid duplicating assigned materials when duplicating a mesh? how can I prevent Blender 2.8 from duplicating materials every time (?) I duplicate a mesh. Origin/reason for the expression "on the bus" instead of "in the bus" Let $p$ be an odd prime number. Prove that $$\left( \frac{1 \cdot 2}{p} \right) + \left( \frac{2 \cdot 3}{p} \right) + \left( \frac{3 \cdot 4}{p} \right) + \cdots + \left( \frac{(p-2)(p-1)}{p} \right) = -1$$ where $\left( \frac{a}{p}\right)$ is the Legendre symbol.  This seems to be a tricky one! I've tried using the property $\left( \frac{ab}{p} \right)=\left( \frac{a}{p}\right) \left( \frac{b}{p} \right)$ and prime factoring all the non-primes but to no avail. I had a quick thought of induction haha, but that was silly. I tried factoring the common Legendre symbols like $\left( \frac{3}{p}\right) \left[ \left( \frac{2}{p} \right) + \left( \frac{4}{p} \right) \right]$ but that didn't bring anything either. And I've been looking for pairwise cancellation with $1$ term leftover, but that does not seem to work.  Can you help? Examples of infinite groups such that all their respective elements are of finite order. I am in need of examples of infinite groups such that all their respective elements are of finite order. I saw this today, I checked in Mathematica and the integral comes out to $\pi$, but I have no idea how to solve it.     FREE Wi-Fi: The Wi-Fi password is the first $10$ digits of the answer.   $$\int_{-2}^2\left(x^3\cos\frac x2+\frac12\right)\sqrt{4-x^2}\ dx$$ The space $C^0([0;1],\mathbb{R})$ of all continuous, real-valued functions on $[0,1]$ is not reflexive. I have purchased a rather large bag of long-grain white rice (25 lbs.) and need to know the best way for storing it long-term. This rice will be used as both a food-storage food source and as my everyday source of rice for cooking, so the storage solution should (hopefully) be resealable, rather than once-it's-open-it's-open. I eat rice maybe three times a month, so it isn't really "everyday" but it will be my go-to when I have it. Prevent browser caching of AJAX call result It looks like if I load dynamic content using $.get(), the result is cached in browser.  Adding some random string in QueryString seems to solve this issue (I use new Date().toString()), but this feels like a hack.   Is there any other way to achieve this? Or, if unique string is the only way to achieve this, any suggestions other than new Date()? How do I convert two lists into a dictionary? Imagine that you have the following list. keys = ['name', 'age', 'food'] values = ['Monty', 42, 'spam']  What is the simplest way to produce the following dictionary? a_dict = {'name': 'Monty', 'age': 42, 'food': 'spam'} How are Clash of Clans multiplayer battles determined Are battles determined by level or trophies? Just curious. Inequality $\frac{1}{n+1}+\frac{1}{n+2}+...+\frac{1}{3n+1} \ge 1$ I typed up an assignment with a lot of numbers in LaTeX and turned it in to my adviser.  When he returned it to me with some corrections, one of which was a lot of $ around my numbers.  I understand that $ are necessary around some mathematical formulas, but I was just using numbers like -2 and 4.  I did not see any change in the font of the numbers when I added the $ either.  Since my adviser did not want to give me an explanation, what is the rationale? Increasing spacing between section number and title in the table of contents I'm using the simple ordinary \tableofcontents command to produce a table of contents, and I find that the resulting spacing between the section number and the section title is too small:    Can someone tell me how to fix this, please. My documentclass is memoir, if that matters. I currently have a valid Schengen tourist visa that expires next year, issued by the French Consulate in Saudi Arabia.   I am going to a 60-day study abroad program in Italy and they require a student visa. I went to the Italian Consulate in Boston and they asked me to go to the French Consulate and cancel my visa. However, the French Consulate said that I needed to contact the French Embassy in Saudi to cancel the visa.   How can I cancel my tourist visa if I am currently in the United States? My Italian student visa application is due tomorrow morning. How to calculate: $\sum_{n=1}^{\infty} n a^n$ I've tried to calculate this sum:  $$\sum_{n=1}^{\infty} n a^n$$  The point of this is to try to work out the "mean" term in an exponentially decaying average.  I've done the following:  $$\text{let }x = \sum_{n=1}^{\infty} n a^n$$ $$x = a + a \sum_{n=1}^{\infty} (n+1) a^n$$ $$x = a + a (\sum_{n=1}^{\infty} n a^n + \sum_{n=1}^{\infty} a^n)$$ $$x = a + a (x + \sum_{n=1}^{\infty} a^n)$$ $$x = a + ax + a\sum_{n=1}^{\infty} a^n$$ $$(1-a)x = a + a\sum_{n=1}^{\infty} a^n$$  Lets try to work out the $\sum_{n=1}^{\infty} a^n$ part:  $$let y = \sum_{n=1}^{\infty} a^n$$ $$y = a + a \sum_{n=1}^{\infty} a^n$$ $$y = a + ay$$ $$y - ay = a$$ $$y(1-a) = a$$ $$y = a/(1-a)$$  Substitute y back in:  $$(1-a)x = a + a*(a/(1-a))$$ $$(1-a)^2 x = a(1-a) + a^2$$ $$(1-a)^2 x = a - a^2 + a^2$$ $$(1-a)^2 x = a$$ $$x = a/(1-a)^2$$  Is this right, and if so is there a shorter way?  Edit:  To actually calculate the "mean" term of a exponential moving average we need to keep in mind that terms are weighted at the level of $(1-a)$. i.e. for $a=1$ there is no decay, for $a=0$ only the most recent term counts.  So the above result we need to multiply by $(1-a)$ to get the result:  Exponential moving average "mean term" = $a/(1-a)$  This gives the results, for $a=0$, the mean term is the "0th term" (none other are used) whereas for $a=0.5$ the mean term is the "1st term" (i.e. after the current term). How to show every field is a Euclidean Domain. I'm having trouble proving this. This is what I have so far:  Let $F$ be a field. Let $v(x) \rightarrow 1$ for all $x$ not equal to $0$.  So if we let $x$ be in $F$ where $x$ not zero then we can write $x$ as: $x=qy+r$ for some $y$ in $F$. If $r$ not zero then $V(r)=1$.  Not sure what to do from here. I know eventually I'm supposed to get no remainder $(r=0)$ but I'm stuck at applying the definition and valuation map. In older versions of Windows and even in Windows 10 previews you could enable the built-in guest account in control panel     Control Panel\User Accounts\User Accounts\Manage Accounts     In Windows 10, the Guest entry is missing.  Using Computer Management or net user you can still enable the guest account, but even then it doesn't show up on the logon screen.  In the Local Security Policy secpol.msc:     Local Policies - User Rights Assignment - Deny log on locally   we can see guest listed, this wasn't the case in older versions of Windows.  After removing guest from that policy, it is listed on the logon screen and we can using it to log on.  However, the whole Explorer shell is crashing and restarting constantly. The desktop is blinking and you can't click anything.  So the guest account is totally broken.   There is a  about this showing that some code was quickly added to the control panel to not show the guest account. So Microsoft does know about the problem.  While I don't really expect anybody to know what they've done to break this, at least this explains why the guest account is currently not listed. I use the highlight mode in vim to copy a few characters.  I then want to paste more than once.  My current technique does not work well.  Sample text: Linux Solaris Irix HP-UX  Suppose I want to copy the word Linux, then paste over Solaris and Irix.   Place cursor at L in Linux Command v (for visual hilite), then e (for end-of-word), then y (for yank/copy) Now Linux is on my "vim clipboard" Move cursor to S in Solaris (first instance) Command v (for visual hilite), then e (for end-of-word), then p (for paste) Text is now: Linux Linux Irix HP-UX, but now Solaris is on my "vim clipboard" Move cursor to I in Irix (second instance) Command v (for visual hilite), then e (for end-of-word), then p (for paste) Text is now: Linux Linux Solaris HP-UX which is not what I expected.   I resort to using highlite/paste with the mouse (via X Terminal).  Surely, I can do this better.  How?