I need to remove a single closed parentheses from a string to fix an edge case in a simpler regex problem.   I need to remove text from within parentheses, but the solution I am currently using doesn't handle an extra single closed parentheses well. Should I use a different approach or can I add an extra step to handle this case?   Below is an example where all answers should be brother &amp; I highlighted the line that it fails on below  cleaner = function(x){   x = tolower(x)   ## if terms are in brackets - assume this is an alternative and remove   x = stringr::str_remove_all(x, "\\(.*\\)")   ## if terms are seperated by semi-colons or commas, take the first, assume others are alternatives and remove   x = gsub("^(.*?)(,|;).*", "\\1", x)   ## remove whitespace   x = stringi::stri_replace_all_charclass(x, "\\p{WHITE_SPACE}", "")   x }  cleaner("brother(bro)") cleaner("brother;bro") cleaner("bro   ther") cleaner("(bro)brother   ;bro") cleaner("(bro)brother   ;bro)") ## this fails cleaner("(bro)brother   ;(bro") # this doesnt  stringr::str_remove_all("(bro)brother   ;bro)", "\\(.*\\)")   Thanks,   Sam
I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully  I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Project Name up to the part where it says J0000011: (the 11 is going to be a different number every time). Here's the regex I've been playing with: Project name:\s+(.*)\s+J[0-9]{7}:  The problem is that it doesn't stop until it hits the J0000020: at the end. How do I make the regex stop at the first occurrence of J[0-9]{7}?
Find all integer solutions to $x^2+4=y^3$. How can I convert JPG into PDF easily? Is there any way to batch convert .jpg files into single .pdf files? Execute an installed Python package as a script? Trying to solve     $f(x)$ is uniformly continuous in the range of $[0, +\infty)$ and $\int_a^\infty f(x)dx  $ converges.   I need to prove that: $$\lim \limits_{x \to \infty} f(x) = 0$$  Would appreciate your help! How do I type Arabic text in Photoshop? I want to type Arabic text in Photoshop, but the text appears disjointed and the letters do not connect at all. For example محمد appears as م ح م د.   I'm using Photoshop CS6 on OSX Mountain Lion. $a, b, c$ are positive real numbers.   Prove that $$8abc\le (a+b)(b+c)(c+a)$$  I haven't really gotten anywhere, just tried to open up $(a+b)(b+c)(c+a)$ and got null. Why is $\frac{d^n}{dx^n}(y(x))$ the notation for the $n$th derivative of $y(x)$, instead of $\frac{d^n}{d^nx}(y(x))$? I've always wondered why the numerator is $d^n$ while the denominator is $dx^n$ instead of $d^nx$ like the numerator.  I must be missing something very obvious or fundamental. Is this notation derived from the chain rule in some way? How to change the date format? Presently the date is showing as mmm dd hh:mm:ss. Is there any way that I can change it to as per my liking. For example : dd mmm, hh:mm:ss. What is the best collation to use for MySQL with PHP? Yes, it's time for me to complain about plagiarism again.  We already have Suggested Edit audits, but I would like to see Tag Wiki and Tag Wiki Excerpt audits that specifically introduce copied content for that tag without including the appropriate source(s), and warn people who approve it that they just approved a tag with plagiarized text.  For example, an audit for the  tag could be:     Microsoft SQL Server is a relational database management system developed by Microsoft. As a database, it is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network (including the Internet). There are at least a dozen different editions of Microsoft SQL Server aimed at different audiences and for different workloads (ranging from small applications that store and retrieve data on the same computer, to millions of users and computers that access huge amounts of data from the Internet at the same time). Its primary query languages are T-SQL and ANSI SQL.   Anyone who spends 15 seconds Googling this will see where it came from -- the problem is, most people don't.  I know with Suggested Edit Audits, it's just random text to catch the most egregious reviewers; for this, you would have to most likely select a small sample of tags, and then create their copy-and-paste entries for audits.    The whole point of this would be to raise awareness for people who have figured out how to recognize and pass Suggested Edit audits, but still don't understand the finer nuances of reviewing. How to hyperlink only the year part when using natbib and hyperref I am using the natbib and hyperref packages:  \usepackage{natbib}  \usepackage[pagebackref=true, plainpages=false, bookmarks, bookmarksnumbered, colorlinks, linktocpage=true, linkcolor=blue, citecolor=blue, filecolor=black, urlcolor=blue]{hyperref}   With my current settings (above) both the name and the year are hyperlinked.  My question is, whether there is a way to hyperlink (or color) only the year-not the author(s).   I have the impression reading this post  that biblatex does it by default. However changing to biblatex is not an option for me at this point.  Any helpful comments will be greatly appreciated. Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen? Why does stdafx.h work the way it does? As usual, when my brain's messing with something I can't figure out myself, I come to you guys for help :)  This time I've been wondering why stdafx.h works the way it does? To my understanding it does 2 things:   Includes standard headers which we might (?) use and which are rarely changed Work as a compiler-bookmark for when code is no longer precompiled.   Now, these 2 things seems like two very different tasks to me, and I wonder why they didn't do two seperate steps to take care of them? To me it seems reasonable to have a #pragma-command do the bookmarking stuff and to optionally have a header-file a long the lines of windows.h to do the including of often-used headers... Which brings me to my next point: Why are we forced to include often-used headers through stdafx.h? Personally, I'm not aware of any often used headers I use that I'm not already doing my own includes for - but maybe these headers are necessary for .dll generation?  Thx in advance What contributes to expanded company details being displayed in Google search results? For some results returned in Google Search, on the right side it displays the company details, logo, contact numbers, etc...   For example, see the following screenshot:    I'd like to know what contributes to this so that I can try to achieve it for my site too. What is the life expectancy of a Wookiee? At lunch, my coworkers and I were discussing The Force Awakens, and started questioning Chewbacca's age.  A quick check of  and it says he is possibly about 230 years old as of Episode VII.  Following the  link on that page, Wookieepedia claims that they live to be 400 years old.  Do we know from canon what the average life expectancy of a Wookiee is? I have got a template class as follows:  class MyClass&lt;T&gt; {     T field;     public void myMethod()     {        field = new T(); // gives compiler error     } }   How do I create a new instance of T in my class? "wait more than" vs. "wait FOR more than" If you make him wait (for) more than ten minutes, he'll just walk away.  I found both instances on Google Books:  and . So I'm a bid confused. Let's say I have Windows installed on drive C, however I install all of my programs on the D drive, and I keep my user profile on the D drive as well (things like My Documents). How can I have Windows use those folders instead of the ones on the C drive? I'd like to create a Windows bootable USB stick, but I don't have a Windows machine with me at the moment to do so. How could I achieve the same using Ubuntu? Why is paper more frangible when it is wet? My four-year-old daughter asked me why paper tends to fall apart when wet, and I wasn't sure.  I speculated that the water lubricates the paper fibers so that they can untangle and separate more easily, but I really wasn't sure.