I'm currently trying to do some basic cleaning on a pdf so I can convert it to ePub for use on my e-reader. All I'm doing is removing page numbers (easy) and footnotes (stumped so far). Basically, I'd like an expression that finds the tag pattern at the beginning of every footnote ( &lt;bar&gt; followed by a newline, a number, and either a letter or a quotation mark), selects the pattern and everything after it until it reaches the &lt;hr/1&gt; tag at the beginning of the next page. Here's some sample text: The phantoms, for so they then seemed, were flitting on the other side of &lt;br&gt; the deck, and, with a noiseless celerity, were casting loose the tackles and bands &lt;br&gt; of the boat which swung there. This boat had always been deemed one of the spare boats &lt;br&gt; technically called the captain’s, on account of its hanging from the starboard quarter.&lt;br&gt; The figure that now stood by its bows was tall and swart, with one white tooth &lt;br&gt; evilly protruding from its steel-like lips. &lt;br&gt;  &lt;br&gt; 1 &quot;Hardly&quot; had they pulled out from under the ship’s lee, when a &lt;br&gt; fourth keel, coming from the windward side, pulled round under the stern, &lt;br&gt; and showed the five strangers &lt;br&gt; 127 &lt;br&gt; &lt;br&gt; &lt;hr/&gt;  Since all of the footnotes are formatted this way, I want to select every group of lines that begin with  &lt;br&gt; (note the space) and end with the &lt;hr/&gt; tag. This is my first time really trying to use regex, so I've tried to hack together some attempts at solutions:  \s&lt;br&gt;\n\d+\s[a-zA-Z“].*: This correctly selects  &lt;br&gt; and the first line of the footnote, but stops at the break. \s&lt;br&gt;\n\d+\s[a-zA-Z“].*\n.*\n.*\n.*\n.*\n.* selects the correct number of lines, but this will obviously only work for footnotes that happen to have three lines of text.  \s&lt;br&gt;\n\d+\s[a-zA-Z“]((.*\n)*)&lt;hr\/&gt; starts at the correct place at the first footnote, but then ends up selecting the entirety of the rest of the document. My interpretation of this expression is &quot;start with  &lt;br&gt;, a number followed by a space followed by a letter or quotation mark, then select everything including newlines until you reach &lt;hr/&gt;.&quot;  \s&lt;br&gt;\n\d+\s[a-zA-Z“]((?:.*\r?\n?)*)&lt;hr\/&gt;\n same idea as (2), with the same result, though I am not familiar enough with regex to quite understand what is going on with this one.   Basically, my problem is that my expressions either exclude newlines (and ignores the end pattern) or it include every newline and returns the entirety of the text (and obviously still ignores the ending pattern. How do I get it to return just the text between the patterns, including the newlines?
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}?
What's the function like sum() but for multiplication? product()? Python's  function returns the sum of numbers in an iterable.  sum([3,4,5]) == 3 + 4 + 5 == 12   I'm looking for the function that returns the product instead.  somelib.somefunc([3,4,5]) == 3 * 4 * 5 == 60   I'm pretty sure such a function exists, but I can't find it. Eccentricity of an ellipse How is $\frac{PF}{PD} = e = \frac{C}{A}$ ? where e is eccentricity, P stands for any point on the ellipse. $F$ stands for one of the foci. $e$ stands for eccentricity. $D$ is a point on the directrix of the ellipse. 'C' is the distance from the center to the focus of the ellipse 'A' is the distance from the center to a vertex.   This is referring to an ellipse/hyperbola/parabola and their conic sections. The problem is not the proof for how $PF/PD = e$, or how $C/A = e$, but how the two equate to each other. (The letters stem from the points/foci of an ellipse of a cone and its directrix).  What is the answer that does NOT use analytic geometry? (only trigonometry) What is the difference between UNION and UNION ALL? What is the difference between UNION and UNION ALL? What are the odds of hitting exactly 100 rolling a fair die Prevent pdflatex from writing a bunch of files If I create just a basic hello.tex file an compile it using   pdflatex hello.tex   The pdflatex program is creating a plethora of file which is a little annoying. Currently it writes all those files about which I really don't care:  hello.aux, hello.log, hello.nav, hello.out, hello.snm, hello.toc   Is there a way to tell pdflatex to only write hello.pdf if the build is successful ? If not, can I specify the output directory of those files ? Maybe I could just write them in /tmp. Lower bounds for ${{2n} \choose {n}}$ What are common lower bounds for ${{2n} \choose {n}}$?    Edit:  I made a mistake in my original question.  It doesn't change my question but there is no reason for me to include the mistake. Explicit norm on $\mathcal{C}^0(\mathbb{R},\mathbb{R})$ Do you know an explicit norm on $\mathcal{C}^0(\mathbb{R},\mathbb{R})$? Using the axiom of choice, every vector space admits a norm but have you an explicit formula on  $\mathcal{C}^0(\mathbb{R},\mathbb{R})$?  A related question is: Can we proved that $\mathcal{C}^0(\mathbb{R},\mathbb{R})$ has a norm without the axiom of choice? Sometime in the 1970s (I think) I saw a really awful film set in a small town by a lake. The film opened with some people camping out in the woods. One of them was zipped up in a sleeping bag. Something (as yet unidentified) moved in between the sleeping camper and the camera, and we heard a "crunch." When the creature moved off, we saw that it had bitten the head off the camper, causing a fountain of blood to spout of of the neck. Far from being shocking or gory, it was so badly done as to be laughable.  The main story was that these huge and nasty mutated creatures were coming out of the lake and eating people. A local industrial company was under suspicion for poisoning the lake, but repeated water tests showed it to be clean.  In the end, someone had the idea of testing the water at the bottom of the lake, which revealed it to be heavily poisoned with mercury. As mercury is much heavier than water, it had sunk, so the previous tests (done from a small row boat) had missed it as they only sampled the water at the surface.  They got it all sorted out eventually, and the bad guys ended up in prison.  After the credits had rolled, and you thought it was all over, another monster reared up in front of the camera and roared. I think we were supposed to go "Oh no, it's not all over!" However, the few people stupid enough not to have left by now laughed at the ridiculous sight and left, shaking their heads wondering why they had bothered!  I have a morbid fascination to see it again. Anyone have any idea what it was called? Why can't I paste § into a Minecraft command? At the start of A New Hope are Yoda and Obi-Wan really the last remaining Jedi? I have never read any Star Wars books and have no knowledge outside of the Star Wars films, but after seeing Episode III I am left wondering if there are any other Jedi that escape death and remain in hiding like Yoda did. I mean with regard to the "official" events in the Star Wars universe. Video showing up as white space On  question, there is a YouTube video in , on the Android app the video shows up as a white space. There is no indication that it is a video.  Would it be possible to show the video in the app or link to the video on YouTube instead? Different font color for question status => closed <= When I stared at  () and I even thought [question refined] as offical status of the post.    &lt;somebody  it now, So, I've edited this question to get same effect>  How about official status [closed] as   different font color or  different font size or put the text [closed] outside the question link   Or   put a special tag as suggested in the    to clarify from those? If I have a Xaml Window, how does one open it as a child window, and then have the parent window wait for the child to close before the parent window continues executing? Mental estimate for tangent of an angle (from $0$ to $90$ degrees) Add/Delete table rows dynamically using JavaScript Why must fermions be antisymmetric? I have read that fermions cannot exist in the same state simultaneously. I understand why indistinguishable particles with an antisymmetric superposition of states can't exist in the same state simultaneously, but why must fermions have an antisymmetric superposition of states?  The only characterising property I know of fermions having besides antisymmetry is spin, for which they have half-integer. I understand that this is the case simply because particles with half-integer spin and particles with zero or integer spin were defined as fermions and bosons respectively.  My perusal of the Wikipedia page on the  leaves me under the impression that spin has nothing to do with the wavefunction's symmetry properties:     Naively, neither has anything to do with the spin, which determines the rotation properties of the particles, not the exchange properties.   Are antisymmetric wavefunctions simply classified as fermions, in the way half-integer spin particles were? I don't see how this could be the case, as, if spin and symmetry were independent, half-integer spin particles with symmetric wavefunctions (and antisymmetric integer spin particles) would be possible. Adverb-adjective compound premodifier with or without hyphen? Remarkably low condensation temperature  or  Remarkably-low condensation temperature?  The focus of remarkable is that it is such a low temperature. We are having an office disagreement and any help is much appreciated. Proving $2$ generates $(\mathbb{Z}/19\mathbb{Z})^*$ by only looking at a few powers Always return data from last week's Monday thru Sunday How can I approach implementing the following in Drupal 7?  What I need to do is create a module which defines a new fieldable entity, called 'Company'. I have a list of, let's say, 20 fields that need to be filled out by each Company instance. These questions are predefined and some may contain custom validation.  At the moment, I'm at the point when I can add new fields to the Company entity. This works fine at the moment. My issue is that I need all these fields to be there as soon the module is installed, so adding them via the interface isn't an option.  I was wondering how can I approach this? I'd assume it comes down being able to do what can be done using the 'Manage Fields' UI programmatically.