I have a html file that I want to do some scrapping using python 3, this is the content of the table that I want to get the data  &lt;tr valign="top" class="font10_n"&gt;     &lt;td&gt;a&lt;/td&gt;     &lt;td&gt;&lt;b&gt;Date Registered&lt;/b&gt;&lt;/td&gt;     &lt;td&gt;04-JULY-2018&lt;/td&gt;     &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt;   This is my current code  import re ... html = html_content registered = re.search(r"""&lt;td&gt;&lt;b&gt;Date Registered&lt;\/b&gt;&lt;\/td&gt;             &lt;td&gt;(.*)&lt;/td&gt;""", html).group(1) print('Registered Date : ' + registered)   I want to make the search only 1 line, is it possible and how to make it?
3211
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}?
7509
I try to write a simple Markdown parser in JavaScript. Therefore I want to check for the [link content][link id] syntax. I use the following code:  data = data.replace( /\[(.*?)\][ ]*\[([0-9]+)\]/g, '&lt;a href="$2"&gt;$1&lt;/a&gt;' );   It works well, but now I want to do this with a RegExp object. So I set up the following bit of code:  var r = new RegExp( '\[(.*?)\][ ]*\[([0-9]+)\]', 'g' ); data = data.replace( r, '&lt;a href="$2"&gt;$1&lt;/a&gt;' );   But it doesn't work. It even says that my regular expression (which works since the first example does a good job) is invalid:     unmatched ) in regular expression   I think it must have to do with some RegExp-object peculiarities I am not aware of. What am I doing wrong and how can the problem be solved?
23137
I was browsing the html of my favorite site...ahem...and I saw this in the markup:  &lt;link href="/Content/all.min.css?d=20090107" rel="stylesheet" type="text/css" /&gt;   what does "?d=20090107" do? I'm assuming it's a date of some kind, but I'm not sure why it's in the path to the file. Any ideas?
6617
I want to loop over the contents of a text file and do a search and replace on some lines and write the result back to the file. I could first load the whole file in memory and then write it back, but that probably is not the best way to do it.  What is the best way to do this, within the following code?  f = open(file) for line in f:     if line.contains('foo'):         newline = line.replace('foo', 'bar')         # how to write this newline back to the file
37425
I have a document with headings and unordered lists. How can I use JQuery to select a given heading (by its unique class name) AND all content between that heading and the next heading? Update: Your suggestions are great, but aren't what I'm looking for. In the below code, for example, I would like to access only the &quot;h1&quot; with id of &quot;heading2&quot; and everything up to, but not including the &quot;h1&quot; with id of &quot;heading3&quot;. The jQuery examples provided above will access everyting after the first &quot;h&quot; tag that is not an &quot;h&quot; tag. ... or, correct me if I'm wrong :)     &lt;h1 id=&quot;heading1&quot;&gt;...&lt;/h1&gt;         &lt;ul&gt;...&lt;/ul&gt;         &lt;p&gt;...&lt;/p&gt;         &lt;ul&gt;...&lt;/ul&gt;         &lt;p&gt;...&lt;/p&gt;     &lt;h1 id=&quot;heading2&quot; &gt;...&lt;/h1&gt;         &lt;ul&gt;...&lt;/ul&gt;         &lt;p&gt;...&lt;/p&gt;         &lt;ul&gt;...&lt;/ul&gt;         &lt;p&gt;...&lt;/p&gt;     &lt;h1 id=&quot;heading3&quot; &gt;...&lt;/h1&gt;         &lt;ul&gt;...&lt;/ul&gt;         &lt;p&gt;...&lt;/p&gt;         &lt;ul&gt;...&lt;/ul&gt;         &lt;p&gt;...&lt;/p&gt;
88730
If I have a script tag like this:  &lt;script     id = "myscript"     src = "http://www.example.com/script.js"     type = "text/javascript"&gt; &lt;/script&gt;   I would like to get the content of the "script.js" file. I'm thinking about something like document.getElementById("myscript").text but it doesn't work in this case.
50375
I'm trying to convert some LaTeX into HTML but my code listings don't preserve their code coloring. Why is that and how do I fix it?  This is what it looks like:    Side note: I'm also wondering why the caption on the table was removed.  Edit  Here is an example listing with colors:  \documentclass{article} \usepackage{color} \usepackage{listings} \lstset{     basicstyle=\footnotesize\ttfamily,     language=[Sharp]C,      keywordstyle=\color[rgb]{0,0,1.0}\bfseries,       commentstyle=\color[rgb]{0.133,0.545,0.133}\bfseries, }  \begin{document} \begin{lstlisting} int x = 10;  // This is a comment string str = "hello"; \end{lstlisting} \end{document}   This produces the following HTML when doing: htlatex myfile.tex:  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd"&gt;   &lt;html &gt;  &lt;head&gt;&lt;title&gt;&lt;/title&gt;  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;  &lt;meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"&gt;  &lt;meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"&gt;  &lt;!-- html --&gt;  &lt;meta name="src" content="LaTeX4.tex"&gt;  &lt;meta name="date" content="2012-07-20 12:30:00"&gt;  &lt;link rel="stylesheet" type="text/css" href="LaTeX4.css"&gt;  &lt;/head&gt;&lt;body  &gt;    &lt;!--l. 12--&gt;    &lt;div class="lstlisting" id="listing-1"&gt;&lt;span class="label"&gt;&lt;a   id="x1-2r1"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;int&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;x&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;=&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;10;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;br /&gt;&lt;span class="label"&gt;&lt;a   id="x1-3r2"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;br /&gt;&lt;span class="label"&gt;&lt;a   id="x1-4r3"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;//&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;This&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;is&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;a&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;comment&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;br /&gt;&lt;span class="label"&gt;&lt;a   id="x1-5r4"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;string&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;str&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;=&lt;/span&gt;&lt;span  class="cmtt-8"&gt;&amp;#x00A0;&lt;/span&gt;&lt;span  class="cmtt-8"&gt;"&lt;/span&gt;&lt;span  class="cmtt-8"&gt;hello&lt;/span&gt;&lt;span  class="cmtt-8"&gt;"&lt;/span&gt;&lt;span  class="cmtt-8"&gt;;&lt;/span&gt;     &lt;/div&gt;  &lt;/body&gt;&lt;/html&gt;   Which looks like this:    I would want the HTML result to look like this:
83607
I've come across a few examples recently that do things like:  &lt;dl&gt;   &lt;dt&gt;Full Name:&lt;/dt&gt;   &lt;dd&gt;&lt;input type="text" name="fullname"&gt;&lt;/dd&gt;   &lt;dt&gt;Email Address:&lt;/dt&gt;   &lt;dd&gt;&lt;input type="text" name="email"&gt;&lt;/dd&gt; &lt;/dl&gt;   for doing HTML forms.  Why is that?  What is the advantage over using tables?
55068
Basically I want to at least check that a download-able file exists / download link works and preferably get stuff like the file size too. Here's an example: link = self.browser.find_element_by_link_text('link text') href = link.get_attribute('href') download = self.browser.get(href) print download  That fourth line prints &quot;None&quot;, presumably because I haven't manually clicked the Save button, and even if I had, I doubt WebDriver would be able to &quot;see&quot; the file. Any ideas? I'm using Firefox as my browser-under-test, and I understand that the file handling for downloads is somewhat browser and/or OS-specific.
108459
Are Python and JavaScript regular expression syntax identical?   If not, then:    What are the important differences between them Is there a python library that "implements" JavaScript regexps?
112555
I have a couple of hundred html source code files.  I need to extract the contents of a particular &lt;div&gt; element from each of these file so I'm going to write a script to loop through each file.  The element structure is like this:  &lt;div id='the_div_id'&gt;   &lt;div id='some_other_div'&gt;   &lt;h3&gt;Some content&lt;/h3&gt;   &lt;/div&gt; &lt;/div&gt;   Can anyone suggest a method by which I can extract the div the_div_id and all the child elements and content from a file using the linux command line?
42087
Writing a python script and it needs to find out what language a block of code is written in. I could easily write this myself, but I'd like to know if a solution already exists.  Pygments is insufficient and unreliable.
28094
I have a text file, i want to search for tags such as the following:  &lt;category="SpecificDisease"&gt;Type II human complement C2 deficiency&lt;/category&gt; &lt;category="Modifier"&gt;Huntington disease&lt;/category&gt; &lt;category="CompositeMention"&gt;hereditary breast and ovarian cancer&lt;/category&gt; &lt;category="DiseaseClass"&gt;myopathy&lt;/category&gt;   and produce the following  and write them to a new text file.  Type II human complement C2 deficiency Huntington disease hereditary breast and ovarian cancer myopathy
69002
So, I see that  to fight site scrapers. But, this is harmful to User Experience. With browsers like Google Chrome, all I can see is the first few characters of the title, and it becomes annoying to try to find the right tab.  So, my request: Can you remove the tag from the &lt;title&gt; using JavaScript? Crawlers will still see the SEO-friendly &lt;title&gt;, and users won't have their user experience hampered by it. We all win.
1603
We used to be able to , but that now appears to be broken.  I'd expect a  to return a result, but instead the search engine appears to put quotes around the whole request; the search box shows the search has been replaced with "[python] += list" and the  I was looking for doesn't appear among the returned questions.  Using quotes around the symbols do not seem to help here;  returns an empty result.
14423
I would like to know if there is a simple way to parse HTML in vb.net. I know that HTML is not sctrict subset of XML, but it would be nice if it could be treated that way.  Is there anything out there that would let me parse HTML in an XML-like way in VB.net?
5499
I often want to search through a man page, however I am forced to either do:  man &lt;package&gt; | grep &lt;search&gt;   Or:  man &lt;package&gt; &gt; file.txt   But there must be an easier way than this to do this, so how can I search through a man page while in it instead of having to send its contents to a file, or use grep to print the necessary matching contents to standard output?