From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sankalp Subject: Re: HTML Export Error : org-export-replace-src-segments-and-examples: Args out of range: 0, 0 Date: Wed, 21 Mar 2012 04:33:56 +0530 Message-ID: References: <87d387kr0w.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d044287a6b1387e04bbb4b19a Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SA86K-000833-OP for emacs-orgmode@gnu.org; Tue, 20 Mar 2012 19:04:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SA86F-0004Ki-Fy for emacs-orgmode@gnu.org; Tue, 20 Mar 2012 19:04:24 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:58031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SA86F-0004KA-0x for emacs-orgmode@gnu.org; Tue, 20 Mar 2012 19:04:19 -0400 Received: by werj55 with SMTP id j55so632753wer.0 for ; Tue, 20 Mar 2012 16:04:16 -0700 (PDT) In-Reply-To: <87d387kr0w.fsf@Rainer.invalid> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org --f46d044287a6b1387e04bbb4b19a Content-Type: text/plain; charset=ISO-8859-1 Hi Achim, On 21 March 2012 01:01, Achim Gratz wrote: > Sankalp writes: > > i.e. at the end I get this error - Args out of range: 0, 0 > > Well, it tells you that the input to that function was unexpected. You > could do M-: (setq debug-on-error) and see what the backtrace turns up. > > Here's what the backtrace says : Debugger entered--Lisp error: (args-out-of-range 0 0) replace-match(#("\n#+BEGIN_html\n
import re     # import the module\n\nmatch = re.search(r'iiit','iiit hyderabad is
in India')\nprint
match.group()\n\nmatch = re.search(r'iiit','iiit is in India.
IIIT offers CS degrees too.')\nprint match.group()\n\nmatch = re.search(r'he','this is the eiffel
tower. The eiffel tower is in France.')\nprint match.group()\n\n
\n\n#+END_html\n" 0 14 (original-indentation 3) 14 961 (org-native-text t org-example t org-protected t original-indentation 3) 961 973 (original-indentation 3)) t t) org-export-replace-src-segments-and-examples() org-export-preprocess-string(#("#+TITLE: Regular Expressions in Python\n#+STARTUP: overview (others are showall)\n#+STARTUP: hidestars\n#+OPTIONS: toc:nil\n\n* Introduction\n\n** Mathematical understanding of regular expressions\n\n\n** regular expressions and Operations\n - sequencing :: by default\n - grouping :: [abc] one of any characters in the group\n - alternation :: |\n - repetition :: a* and a+ and a?\n - complementation :: ^\n\n\n\n** From strings to Regular expressions in Python ::\n Using the 'r' keyword to indicate regular expressions\n instead of strings.\n\n\n** Metacharacters\n\n - $ ::\n - ^ :: inside a group, specifies complementation\n - \\ :: used to escape from the default meaning to a new meaning. Eg, \\w, \\[, \\\\, etc.\n - . ::\n\n** Special symbols ::\n\n - \\d :: matches any decimal\n - \\s :: any whitespace character [\\t\\n\\r\\f\\v]\n - \\w :: any alphanumeric character\n - . :: matches any character except newline\n - more\n\n\n** Compiling regexes\n\n - pat = re.compile(r\"ab*\") :: This \"compiles\" the regular\n expression =ab*=. The result is a pattern object.\n\n** Using regexes\n\n\n - re.match(r, string) :: returns an object that contains\n a match at the BEGINNING of the string, else None.\n\n - re.search(r, string) :: returns an object that contains a\n match ANYWHERE in the string, else None\n\n - re.findall(r, string) :: returns a list that\n contains all the matches of the pattern in the string.\n\n - re.finditer(r, string) :: returns an iterator that\n contains all the matches of the pattern in the string.\n\n\n** Operations on the matched object\n\n - group() :: returns the string matched\n - start() :: returns the start position of the match\n - end() :: returns the end position of the match\n - span() :: returns the group of starting and ending positions.\n\n* Examples\n\n We cover some simple examples of regular expressions\n\n** Basic examples\n\n #+begin_src python :results output :exports both\n import re # import the module\n\n match = re.search(r'iiit','iiit hyderabad is in India')\n print match.group()\n\n match = re.search(r'iiit','iiit is in India. IIIT offers CS degrees too.')\n print match.group()\n\n match = re.search(r'he','this is the eiffel tower. The eiffel tower is in France.')\n print match.group()\n\n #+end_src\n\n #+results:\n : iiit\n : iiit\n : he\n\n\n** Using special characters\n\n*** The =^= and =$=\n\n #+begin_src python :results output :exports both\n import re\n match = re.search(r'^t123','this t123')\n print match # match is None\n\n match = re.search(r'^t123','t123 the')\n print match.group()\n\n match = re.search(r't123$','this t123')\n print match.group()\n\n match = re.search(r't123$','t123 the')\n print match # match is None\n\n #+end_src\n\n #+results:\n : None\n : t123\n : t123\n : None\n\n*** The =*= and =+=\n\n #+begin_src python :results output :exports both\n import re\n\n match = re.search(r'a*','red box in red light')\n print match.group() # Null String, not None\n\n match = re.search(r'a+','red box in red light')\n print match # None\n\n match = re.search(r'a*','a red box in the red light')\n print match.group()\n #+end_src\n\n #+results:\n=\nNone\na\n= :\n : None\n : a\n\n*** The =?= and =.=\n\n #+begin_src python :results output :exports both\n import re\n\n match = re.search(r'a?','red box in red light')\n print match.group() #Null String, not None\n\n # pattern is ={'a'}\n match = re.search(r'a.','red box in red light')\n print match # None\n\n match = re.search(r'a.','a red box in the red light')\n print match.group()\n #+end_src\n\n #+results:\n=\nNone\na \n= :\n : None\n : a\n\n*** The =\\w, \\d, \\W= etc.\n\n #+begin_src python :results output :exports both\n import re\n\n match = re.search(r'a\\w+','pelican')\n print match.group()\n\n match = re.search(r'a\\w+','mica')\n print match #None\n\n match = re.search(r'a\\W','pelican is a bird')\n print match.group()\n\n match = re.search(r'a\\d','His password is a12@')\n print match.group()\n\n #+end_src\n\n #+results:\n : an\n : None\n : a \n : a1\n\n*** Using =[]=\n\n #+begin_src python :results output :exports both\n import re\n\n match = re.search(r'[a-d]+pocalypse','apocalypse')\n print match.group()\n\n match = re.search(r'[a-d]+arwin','arwin')\n print match # None\n\n #+end_src\n\n #+results:\n : apocalypse\n : None\n\n*** Using =|=\n\n #+begin_src python :results output :exports both\n import re\n\n match = re.search(r'[t|f]ree','tree is free')\n print match.group()\n\n match = re.search(r'[t|f]ree','bree')\n print match #None\n\n #+end_src\n\n #+results:\n : tree\n : None\n\n*** Escaping special characters\n\n #+begin_src python :results output :exports both\n import re\n\n match = re.search(r'2\\+3','Compute value of 2+3')\n print match.group()\n\n #+end_src\n\n #+results:\n : 2+3\n\n\n*** Regex to match a floating point number\n\n #+begin_src python :results output :exports both\n import re\n \n match = re.search(r'[0-9]+\\.[0-9]+','pi is 3.14')\n print match.group()\n \n match = re.search(r'[0-9]+\\.[0-9]+','There are 3 primary colors.')\n print match #None\n \n match = re.search(r'[0-9]+\\.[0-9]+','The date is 15.02.2012')\n print match.group() # This matches! It should not! Students should fix this\n #+end_src\n\n #+results:\n : 3.14\n : None\n : 15.02\n\n** Using groups and other advanced constructs\n*** Groups\n #+begin_src python :results output :exports both\n import re\n \n match = re.search(r'([0-9]*\\w+&),([0-9]+)','This&,9')\n print match.group()\n print match.group(0)\n print match.group(1)\n print match.group(2)\n \n #+end_src\n\n #+results:\n : This&,9\n : This&,9\n : This&\n : 9\n\n*** =findall=\n #+begin_src python :results output :exports both\n import re\n \n match = re.findall(r'[0-9]+','123 is another string like 456')\n print match\n \n #+end_src\n\n #+results:\n : ['123', '456']\n\n*** =compile=\n Internally, every regular expression is translated (i.e,\n compiled) into an internal representation (an object). This\n compiled object can be saved and reused, as the\n following examples show.\n\n #+begin_src python :results output :exports both\n import re\n \n pattern = re.compile(r'[0-9]+')\n matchlist = pattern.findall('123 is another string like 456')\n print matchlist\n \n #+end_src\n\n #+results:\n : ['123', '456']\n\n* References\n\n 1. http://docs.python.org/library/re.html\n 2. http://code.google.com/edu/languages/google-python-class/regular-expressions.html\n 3. http://www.regular-expressions.info/python.html\n\n" 0 8 (fontified t face org-document-info-keyword font-lock-fontified t) 8 9 (fontified t face font-lock-comment-face) 9 38 (fontified t face org-document-title font-lock-fontified t) 38 39 (fontified t) 39 81 (fontified t face org-meta-line font-lock-fontified t) 81 82 (fontified t font-lock-fontified t face org-meta-line) 82 102 (fontified t face org-meta-line font-lock-fontified t) 102 103 (fontified t font-lock-fontified t face org-meta-line) 103 121 (fontified t face org-meta-line font-lock-fontified t) 121 122 (fontified t font-lock-fontified t face org-meta-line) 122 123 (fontified t) 123 125 (fontified t face org-level-1) 125 137 (fontified t face org-level-1) 137 139 (fontified t) 139 140 (fontified t face org-hide) 140 142 (fontified t face org-level-2) 142 191 (fontified t face org-level-2) 191 194 (fontified t) 194 195 (fontified t face org-hide) 195 197 (fontified t face org-level-2) 197 231 (fontified t face org-level-2) 231 235 (fontified t) 235 248 (fontified t face (bold)) 248 263 (fontified t) 263 275 (fontified t face (bold)) 275 322 (fontified t) 322 336 (fontified t face (bold)) 336 342 (fontified t) 342 355 (fontified t face (bold)) 355 376 (fontified t) 376 394 (fontified t face (bold)) 394 400 (fontified t) 400 401 (fontified t face org-hide) 401 403 (fontified t face org-level-2) 403 451 (fontified t face org-level-2) 451 509 (fontified t) 509 1804 (fontified nil) 1804 1805 (fontified t) 1805 1807 (fontified t face org-level-1) 1807 1815 (fontified t face org-level-1) 1815 1873 (fontified t) 1873 1874 (fontified t face org-hide) 1874 1876 (fontified t face org-level-2) 1876 1890 (fontified t face org-level-2) 1890 1892 (fontified t) 1892 1943 (fontified t font-lock-fontified t font-lock-multiline t face org-block-begin-line) 1943 1944 (fontified t font-lock-fontified t font-lock-multiline t face org-block-begin-line) 1944 1949 (fontified t font-lock-fontified t font-lock-multiline t face nil) 1949 1950 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-keyword-face) 1950 1955 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-keyword-face) 1955 1956 (fontified t font-lock-fontified t font-lock-multiline t face nil) 1956 1963 (fontified t font-lock-fontified t font-lock-multiline t face nil) 1963 1964 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-comment-face) 1964 1983 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-comment-face) 1983 1984 (fontified t font-lock-fontified t font-lock-multiline t face nil) 1984 1989 (fontified t font-lock-fontified t font-lock-multiline t face nil) 1989 1990 (fontified t font-lock-fontified t font-lock-multiline t face py-variable-name-face) 1990 1994 (fontified t font-lock-fontified t font-lock-multiline t face py-variable-name-face) 1994 1995 (fontified t font-lock-fontified t font-lock-multiline t face nil) 1995 2008 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2008 2009 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2009 2014 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2014 2015 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2015 2016 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2016 2043 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2043 2044 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2044 2050 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2050 2051 (fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 2051 2055 (fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 2055 2056 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2056 2076 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2076 2077 (fontified t font-lock-fontified t font-lock-multiline t face py-variable-name-face) 2077 2081 (fontified t font-lock-fontified t font-lock-multiline t face py-variable-name-face) 2081 2082 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2082 2095 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2095 2096 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2096 2101 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2101 2102 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2102 2103 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2103 2149 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2149 2150 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2150 2156 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2156 2157 (fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 2157 2161 (fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 2161 2162 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2162 2182 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2182 2183 (fontified t font-lock-fontified t font-lock-multiline t face py-variable-name-face) 2183 2187 (fontified t font-lock-fontified t font-lock-multiline t face py-variable-name-face) 2187 2188 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2188 2201 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2201 2202 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2202 2205 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2205 2206 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2206 2207 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2207 2264 (fontified t font-lock-fontified t font-lock-multiline t face font-lock-string-face) 2264 2265 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2265 2271 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2271 2272 (fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 2272 2277 (fontified t font-lock-fontified t font-lock-multiline t face py-builtins-face) 2277 2291 (fontified t font-lock-fontified t font-lock-multiline t) 2291 2292 (fontified t font-lock-fontified t font-lock-multiline t) 2292 2304 (fontified t font-lock-fontified t font-lock-multiline t face org-block-end-line) 2304 2305 (fontified t face org-block-end-line) 2305 6663 (fontified nil) 6663 6664 (fontified t) 6664 6666 (fontified t face org-level-1) 6666 6676 (fontified t face org-level-1) 6676 6683 (fontified t) 6683 6720 (fontified t org-no-flyspell t mouse-face highlight face org-link keymap (keymap ... ... ...)) 6720 6721 (fontified t org-no-flyspell t mouse-face highlight face org-link keymap (keymap ... ... ...) rear-nonsticky (mouse-face highlight keymap invisible intangible help-echo org-linked-text)) 6721 6727 (fontified t) 6727 6807 (fontified t org-no-flyspell t mouse-face highlight face org-link keymap (keymap ... ... ...)) 6807 6808 (fontified t org-no-flyspell t mouse-face highlight face org-link keymap (keymap ... ... ...) rear-nonsticky (mouse-face highlight keymap invisible intangible help-echo org-linked-text)) 6808 6814 (fontified t) 6814 6860 (fontified t org-no-flyspell t mouse-face highlight face org-link keymap (keymap ... ... ...)) 6860 6861 (fontified t org-no-flyspell t mouse-face highlight face org-link keymap (keymap ... ... ...) rear-nonsticky (mouse-face highlight keymap invisible intangible help-echo org-linked-text)) 6861 6863 (fontified t)) :emph-multiline t :for-backend html :skip-before-1st-heading nil :drawers nil :todo-keywords t :tasks t :tags not-in-toc :priority nil :footnotes t :timestamps t :archived-trees headline :select-tags ("export") :exclude-tags ("noexport") :add-text nil :LaTeX-fragments t) org-export-as-html(nil) call-interactively(org-export-as-html) org-export(nil) call-interactively(org-export nil nil) I'm not sure what to make of it, though. > > Strangely, doing an export for the 2nd time, without deleting the > > output html file manages to do it successfully without throwing any > > errors. > There's a correction. On the first pass, no html file is generated. But I feel it must have something to do with the Python shell buffers that get created (and are left with the comint:run status) after each export. > > Which seems to hint at some undeclared variable that is brought into > scope by the first run. > > > Regards, > Achim. > -- > +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ > > Factory and User Sound Singles for Waldorf Q+, Q and microQ: > http://Synth.Stromeko.net/Downloads.html#WaldorfSounds > > > thanks for the prompt response. -- Sankalp ******************************************************* If humans could mate with software, I'd have org-mode's babies. --- Chris League on Twitter. http://orgmode.org/worg/org-quotes.html ******************************************************* --f46d044287a6b1387e04bbb4b19a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Achim,

On 21 March 2012 01:01, Achim Gratz <Stromeko@nexgo.de> wrote:
Sankalp <san= kalpkhare@gmail.com> writes:
> i.e. at the end I get this error - Args out of range: 0, 0

Well, it tells you that the input to that function was unexpected. = =A0You
could do M-: (setq debug-on-error) and see what the backtrace turns up.


Here's what the backt= race says :

Debug= ger entered--Lisp error: (args-out-of-range 0 0)
=A0 replace-match(#("= ;\n#+BEGIN_html\n<pre class=3D\"src src-python\"><span s= tyle=3D\"color: #a020f0;\">import</span> re=A0=A0=A0=A0 = <span style=3D\"color: #b22222;\"># import the module</s= pan>\n\n<span style=3D\"color: #000000; background-color: #fffff= f;\">match</span> =3D re.search(r<span style=3D\"colo= r: #8b2252;\">'iiit'</span>,<span style=3D\"c= olor: #8b2252;\">'iiit hyderabad is in India'</span>)= \n<span style=3D\"color: #7a378b;\">print</span> matc= h.group()\n\n<span style=3D\"color: #000000; background-color: #fff= fff;\">match</span> =3D re.search(r<span style=3D\"co= lor: #8b2252;\">'iiit'</span>,<span style=3D\"= ;color: #8b2252;\">'iiit is in India. IIIT offers CS degrees to= o.'</span>)\n<span style=3D\"color: #7a378b;\">pr= int</span> match.group()\n\n<span style=3D\"color: #000000; b= ackground-color: #ffffff;\">match</span> =3D re.search(r<s= pan style=3D\"color: #8b2252;\">'he'</span>,<= span style=3D\"color: #8b2252;\">'this is the eiffel tower= . The eiffel tower is in France.'</span>)\n<span style=3D\&quo= t;color: #7a378b;\">print</span> match.group()\n\n</pre>= ;\n\n#+END_html\n" 0 14 (original-indentation 3) 14 961 (org-native-te= xt t org-example t org-protected t original-indentation 3) 961 973 (origina= l-indentation 3)) t t)
=A0 org-export-replace-sr= c-segments-and-examples()
=A0 org-export-prepr= ocess-string(#("#+TITLE: Regular Expressions in Python\n#+STARTUP: ove= rview=A0=A0 (others are showall)\n#+STARTUP: hidestars\n#+OPTIONS: toc:nil\= n\n* Introduction\n\n** Mathematical understanding of regular expressions\n= \n\n** regular expressions and Operations\n - sequencing :: by default\n - = grouping=A0 ::=A0 [abc]=A0 one of any characters in the group\n - alternati= on :: |\n - repetition :: a* and a+ and a?\n - complementation :: ^\n\n\n\n= ** From strings to Regular expressions in Python ::\n=A0=A0 Using the '= r' keyword to indicate regular expressions\n=A0=A0 instead of strings.\= n\n\n** Metacharacters\n\n=A0 - $ ::\n=A0 - ^ :: inside a group, specifies = complementation\n=A0 - \\ :: used to escape from the default meaning to a n= ew meaning.=A0 Eg, \\w, \\[, \\\\, etc.\n=A0 - . ::\n\n** Special symbols := :\n\n=A0 - \\d :: matches any decimal\n=A0 - \\s :: any whitespace characte= r [\\t\\n\\r\\f\\v]\n=A0 - \\w :: any alphanumeric character\n=A0 - .=A0 ::= matches any character except newline\n=A0 - more\n\n\n** Compiling regexes= \n\n - pat =3D re.compile(r\"ab*\") :: This \"compiles\"= ; the regular\n=A0=A0=A0=A0=A0 expression =3Dab*=3D.=A0 The result is a pat= tern object.\n\n** Using regexes\n\n\n - re.match(r<pattern>, string)= :: returns an object that contains\n=A0=A0=A0=A0=A0 a match at the BEGINNI= NG of the string, else None.\n\n - re.search(r<pattern>, string) :: r= eturns an object that contains a\n=A0=A0=A0=A0=A0 match ANYWHERE in the str= ing, else None\n\n - re.findall(r<pattern>, string) :: returns a list= that\n=A0=A0=A0=A0=A0 contains all the matches of the pattern in the strin= g.\n\n - re.finditer(r<pattern>, string) :: returns an iterator that\= n=A0=A0=A0=A0=A0 contains all the matches of the pattern in the string.\n\n= \n** Operations on the matched object\n\n=A0 - group() :: returns the strin= g matched\n=A0 - start() :: returns the start position of the match\n=A0 - = end() :: returns the end position of the match\n=A0 - span() :: returns the= group of starting and ending positions.\n\n* Examples\n\n=A0 We cover some= simple examples of regular expressions\n\n** Basic examples\n\n=A0=A0 #+be= gin_src python :results output :exports both\n=A0=A0=A0=A0 import re=A0=A0= =A0=A0 # import the module\n\n=A0=A0=A0=A0 match =3D re.search(r'iiit&#= 39;,'iiit hyderabad is in India')\n=A0=A0=A0=A0 print match.group()= \n\n=A0=A0=A0=A0 match =3D re.search(r'iiit','iiit is in India.= IIIT offers CS degrees too.')\n=A0=A0=A0=A0 print match.group()\n\n=A0= =A0=A0=A0 match =3D re.search(r'he','this is the eiffel tower. = The eiffel tower is in France.')\n=A0=A0=A0=A0 print match.group()\n\n= =A0=A0 #+end_src\n\n=A0=A0 #+results:\n=A0=A0 : iiit\n=A0=A0 : iiit\n=A0=A0= : he\n\n\n** Using special characters\n\n*** The =3D^=3D and =3D$=3D\n\n= =A0=A0=A0 #+begin_src python :results output :exports both\n=A0=A0=A0=A0=A0= import re\n=A0=A0=A0=A0=A0 match =3D re.search(r'^t123','this = t123')\n=A0=A0=A0=A0=A0 print match=A0=A0 # match is None\n\n=A0=A0=A0= =A0=A0 match =3D re.search(r'^t123','t123 the')\n=A0=A0=A0= =A0=A0 print match.group()\n\n=A0=A0=A0=A0=A0 match =3D re.search(r't12= 3$','this t123')\n=A0=A0=A0=A0=A0 print match.group()\n\n=A0=A0= =A0=A0=A0 match =3D re.search(r't123$','t123 the')\n=A0=A0= =A0=A0=A0 print match=A0=A0 # match is None\n\n=A0=A0=A0 #+end_src\n\n=A0= =A0=A0 #+results:\n=A0=A0=A0 : None\n=A0=A0=A0 : t123\n=A0=A0=A0 : t123\n= =A0=A0=A0 : None\n\n*** The =3D*=3D and =3D+=3D\n\n=A0=A0=A0 #+begin_src py= thon :results output :exports both\n=A0=A0=A0=A0=A0 import re\n\n=A0=A0=A0= =A0=A0 match =3D re.search(r'a*','red box in red light')\n= =A0=A0=A0=A0=A0 print match.group()=A0=A0=A0 # Null String, not None\n\n=A0= =A0=A0=A0=A0 match =3D re.search(r'a+','red box in red light= 9;)\n=A0=A0=A0=A0=A0 print match=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 # None\n\= n=A0=A0=A0=A0=A0 match =3D re.search(r'a*','a red box in the re= d light')\n=A0=A0=A0=A0=A0 print match.group()\n=A0=A0=A0 #+end_src\n\n= =A0=A0=A0 #+results:\n=3D\nNone\na\n=3D=A0=A0=A0 :\n=A0=A0=A0 : None\n=A0= =A0=A0 : a\n\n*** The =3D?=3D and =3D.=3D\n\n=A0=A0=A0 #+begin_src python := results output :exports both\n=A0=A0=A0=A0=A0 import re\n\n=A0=A0=A0=A0=A0 = match =3D re.search(r'a?','red box in red light')\n=A0=A0= =A0=A0=A0 print match.group() #Null String, not None\n\n=A0=A0=A0=A0=A0 # p= attern is =3D{'a'}\n=A0=A0=A0=A0=A0 match =3D re.search(r'a.= 9;,'red box in red light')\n=A0=A0=A0=A0=A0 print match # None\n\n= =A0=A0=A0=A0=A0 match =3D re.search(r'a.','a red box in the red= light')\n=A0=A0=A0=A0=A0 print match.group()\n=A0=A0=A0 #+end_src\n\n= =A0=A0=A0 #+results:\n=3D\nNone\na \n=3D=A0=A0=A0 :\n=A0=A0=A0 : None\n=A0= =A0=A0 : a\n\n*** The =3D\\w, \\d, \\W=3D etc.\n\n=A0=A0=A0 #+begin_src pyt= hon :results output :exports both\n=A0=A0=A0=A0=A0 import re\n\n=A0=A0=A0= =A0=A0 match =3D re.search(r'a\\w+','pelican')\n=A0=A0=A0= =A0=A0 print match.group()\n\n=A0=A0=A0=A0=A0 match =3D re.search(r'a\\= w+','mica')\n=A0=A0=A0=A0=A0 print match #None\n\n=A0=A0=A0=A0= =A0 match =3D re.search(r'a\\W','pelican is a bird')\n=A0= =A0=A0=A0=A0 print match.group()\n\n=A0=A0=A0=A0=A0 match =3D re.search(r&#= 39;a\\d','His password is a12@')\n=A0=A0=A0=A0=A0 print match.g= roup()\n\n=A0=A0=A0 #+end_src\n\n=A0=A0=A0 #+results:\n=A0=A0=A0 : an\n=A0= =A0=A0 : None\n=A0=A0=A0 : a \n=A0=A0=A0 : a1\n\n*** Using =3D[]=3D\n\n=A0= =A0=A0 #+begin_src python :results output :exports both\n=A0=A0=A0=A0=A0 im= port re\n\n=A0=A0=A0=A0=A0 match =3D re.search(r'[a-d]+pocalypse',&= #39;apocalypse')\n=A0=A0=A0=A0=A0 print match.group()\n\n=A0=A0=A0=A0= =A0 match =3D re.search(r'[a-d]+arwin','arwin')\n=A0=A0=A0= =A0=A0 print match # None\n\n=A0=A0=A0 #+end_src\n\n=A0=A0=A0 #+results:\n= =A0=A0=A0 : apocalypse\n=A0=A0=A0 : None\n\n*** Using =3D|=3D\n\n=A0=A0=A0 = #+begin_src python :results output :exports both\n=A0=A0=A0=A0=A0 import re= \n\n=A0=A0=A0=A0=A0 match =3D re.search(r'[t|f]ree','tree is fr= ee')\n=A0=A0=A0=A0=A0 print match.group()\n\n=A0=A0=A0=A0=A0 match =3D = re.search(r'[t|f]ree','bree')\n=A0=A0=A0=A0=A0 print match = #None\n\n=A0=A0=A0 #+end_src\n\n=A0=A0=A0 #+results:\n=A0=A0=A0 : tree\n=A0= =A0=A0 : None\n\n*** Escaping special characters\n\n=A0=A0=A0 #+begin_src p= ython :results output :exports both\n=A0=A0=A0=A0=A0 import re\n\n=A0=A0=A0= =A0=A0 match =3D re.search(r'2\\+3','Compute value of 2+3')= \n=A0=A0=A0=A0=A0 print match.group()\n\n=A0=A0=A0 #+end_src\n\n=A0=A0=A0 #= +results:\n=A0=A0=A0 : 2+3\n\n\n*** Regex to match a floating point number\= n\n=A0=A0=A0 #+begin_src python :results output :exports both\n=A0=A0=A0=A0= =A0 import re\n=A0=A0=A0=A0=A0 \n=A0=A0=A0=A0=A0 match =3D re.search(r'= [0-9]+\\.[0-9]+','pi is 3.14')\n=A0=A0=A0=A0=A0 print match.gro= up()\n=A0=A0=A0=A0=A0 \n=A0=A0=A0=A0=A0 match =3D re.search(r'[0-9]+\\.= [0-9]+','There are 3 primary colors.')\n=A0=A0=A0=A0=A0 print m= atch #None\n=A0=A0=A0=A0=A0 \n=A0=A0=A0=A0=A0 match =3D re.search(r'[0-= 9]+\\.[0-9]+','The date is 15.02.2012')\n=A0=A0=A0=A0=A0 print = match.group() # This matches! It should not! Students should fix this\n=A0= =A0=A0 #+end_src\n\n=A0=A0=A0 #+results:\n=A0=A0=A0 : 3.14\n=A0=A0=A0 : Non= e\n=A0=A0=A0 : 15.02\n\n** Using groups and other advanced constructs\n*** = Groups\n=A0=A0=A0 #+begin_src python :results output :exports both\n=A0=A0= =A0=A0=A0 import re\n=A0=A0=A0=A0=A0 \n=A0=A0=A0=A0=A0 match =3D re.search(= r'([0-9]*\\w+&),([0-9]+)','This&,9')\n=A0=A0=A0=A0= =A0 print match.group()\n=A0=A0=A0=A0=A0 print match.group(0)\n=A0=A0=A0=A0= =A0 print match.group(1)\n=A0=A0=A0=A0=A0 print match.group(2)\n=A0=A0=A0= =A0=A0 \n=A0=A0=A0 #+end_src\n\n=A0=A0=A0 #+results:\n=A0=A0=A0 : This&= ,9\n=A0=A0=A0 : This&,9\n=A0=A0=A0 : This&\n=A0=A0=A0 : 9\n\n*** = =3Dfindall=3D\n=A0=A0=A0 #+begin_src python :results output :exports both\n= =A0=A0=A0=A0=A0 import re\n=A0=A0=A0=A0=A0 \n=A0=A0=A0=A0=A0 match =3D re.f= indall(r'[0-9]+','123 is another string like 456')\n=A0=A0= =A0=A0=A0 print match\n=A0=A0=A0=A0=A0 \n=A0=A0=A0 #+end_src\n\n=A0=A0=A0 #= +results:\n=A0=A0=A0 : ['123', '456']\n\n*** =3Dcompile=3D\= n=A0=A0=A0 Internally, every regular expression is translated (i.e,\n=A0=A0= =A0 compiled) into an internal representation (an object).=A0 This\n=A0=A0= =A0 compiled object can be saved and reused, as the\n=A0=A0=A0 following ex= amples show.\n\n=A0=A0=A0 #+begin_src python :results output :exports both\= n=A0=A0=A0=A0=A0 import re\n=A0=A0=A0=A0=A0 \n=A0=A0=A0=A0=A0 pattern =3D r= e.compile(r'[0-9]+')\n=A0=A0=A0=A0=A0 matchlist =3D pattern.findall= ('123 is another string like 456')\n=A0=A0=A0=A0=A0 print matchlist= \n=A0=A0=A0=A0=A0 \n=A0=A0=A0 #+end_src\n\n=A0=A0=A0 #+results:\n=A0=A0=A0 = : ['123', '456']\n\n* References\n\n=A0 1. http://docs.python.org/library/re.html= \n=A0 2. http://code.google.com/edu/languages/goog= le-python-class/regular-expressions.html\n=A0 3. http://www.regular-expressions.in= fo/python.html\n\n" 0 8 (fontified t face org-document-info-keywor= d font-lock-fontified t) 8 9 (fontified t face font-lock-comment-face) 9 38= (fontified t face org-document-title font-lock-fontified t) 38 39 (fontifi= ed t) 39 81 (fontified t face org-meta-line font-lock-fontified t) 81 82 (f= ontified t font-lock-fontified t face org-meta-line) 82 102 (fontified t fa= ce org-meta-line font-lock-fontified t) 102 103 (fontified t font-lock-font= ified t face org-meta-line) 103 121 (fontified t face org-meta-line font-lo= ck-fontified t) 121 122 (fontified t font-lock-fontified t face org-meta-li= ne) 122 123 (fontified t) 123 125 (fontified t face org-level-1) 125 137 (f= ontified t face org-level-1) 137 139 (fontified t) 139 140 (fontified t fac= e org-hide) 140 142 (fontified t face org-level-2) 142 191 (fontified t fac= e org-level-2) 191 194 (fontified t) 194 195 (fontified t face org-hide) 19= 5 197 (fontified t face org-level-2) 197 231 (fontified t face org-level-2)= 231 235 (fontified t) 235 248 (fontified t face (bold)) 248 263 (fontified= t) 263 275 (fontified t face (bold)) 275 322 (fontified t) 322 336 (fontif= ied t face (bold)) 336 342 (fontified t) 342 355 (fontified t face (bold)) = 355 376 (fontified t) 376 394 (fontified t face (bold)) 394 400 (fontified = t) 400 401 (fontified t face org-hide) 401 403 (fontified t face org-level-= 2) 403 451 (fontified t face org-level-2) 451 509 (fontified t) 509 1804 (f= ontified nil) 1804 1805 (fontified t) 1805 1807 (fontified t face org-level= -1) 1807 1815 (fontified t face org-level-1) 1815 1873 (fontified t) 1873 1= 874 (fontified t face org-hide) 1874 1876 (fontified t face org-level-2) 18= 76 1890 (fontified t face org-level-2) 1890 1892 (fontified t) 1892 1943 (f= ontified t font-lock-fontified t font-lock-multiline t face org-block-begin= -line) 1943 1944 (fontified t font-lock-fontified t font-lock-multiline t f= ace org-block-begin-line) 1944 1949 (fontified t font-lock-fontified t font= -lock-multiline t face nil) 1949 1950 (fontified t font-lock-fontified t fo= nt-lock-multiline t face font-lock-keyword-face) 1950 1955 (fontified t fon= t-lock-fontified t font-lock-multiline t face font-lock-keyword-face) 1955 = 1956 (fontified t font-lock-fontified t font-lock-multiline t face nil) 195= 6 1963 (fontified t font-lock-fontified t font-lock-multiline t face nil) 1= 963 1964 (fontified t font-lock-fontified t font-lock-multiline t face font= -lock-comment-face) 1964 1983 (fontified t font-lock-fontified t font-lock-= multiline t face font-lock-comment-face) 1983 1984 (fontified t font-lock-f= ontified t font-lock-multiline t face nil) 1984 1989 (fontified t font-lock= -fontified t font-lock-multiline t face nil) 1989 1990 (fontified t font-lo= ck-fontified t font-lock-multiline t face py-variable-name-face) 1990 1994 = (fontified t font-lock-fontified t font-lock-multiline t face py-variable-n= ame-face) 1994 1995 (fontified t font-lock-fontified t font-lock-multiline = t face nil) 1995 2008 (fontified t font-lock-fontified t font-lock-multilin= e t face nil) 2008 2009 (fontified t font-lock-fontified t font-lock-multil= ine t face font-lock-string-face) 2009 2014 (fontified t font-lock-fontifie= d t font-lock-multiline t face font-lock-string-face) 2014 2015 (fontified = t font-lock-fontified t font-lock-multiline t face nil) 2015 2016 (fontifie= d t font-lock-fontified t font-lock-multiline t face font-lock-string-face)= 2016 2043 (fontified t font-lock-fontified t font-lock-multiline t face fo= nt-lock-string-face) 2043 2044 (fontified t font-lock-fontified t font-lock= -multiline t face nil) 2044 2050 (fontified t font-lock-fontified t font-lo= ck-multiline t face nil) 2050 2051 (fontified t font-lock-fontified t font-= lock-multiline t face py-builtins-face) 2051 2055 (fontified t font-lock-fo= ntified t font-lock-multiline t face py-builtins-face) 2055 2056 (fontified= t font-lock-fontified t font-lock-multiline t face nil) 2056 2076 (fontifi= ed t font-lock-fontified t font-lock-multiline t face nil) 2076 2077 (fonti= fied t font-lock-fontified t font-lock-multiline t face py-variable-name-fa= ce) 2077 2081 (fontified t font-lock-fontified t font-lock-multiline t face= py-variable-name-face) 2081 2082 (fontified t font-lock-fontified t font-l= ock-multiline t face nil) 2082 2095 (fontified t font-lock-fontified t font= -lock-multiline t face nil) 2095 2096 (fontified t font-lock-fontified t fo= nt-lock-multiline t face font-lock-string-face) 2096 2101 (fontified t font= -lock-fontified t font-lock-multiline t face font-lock-string-face) 2101 21= 02 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2102 = 2103 (fontified t font-lock-fontified t font-lock-multiline t face font-loc= k-string-face) 2103 2149 (fontified t font-lock-fontified t font-lock-multi= line t face font-lock-string-face) 2149 2150 (fontified t font-lock-fontifi= ed t font-lock-multiline t face nil) 2150 2156 (fontified t font-lock-fonti= fied t font-lock-multiline t face nil) 2156 2157 (fontified t font-lock-fon= tified t font-lock-multiline t face py-builtins-face) 2157 2161 (fontified = t font-lock-fontified t font-lock-multiline t face py-builtins-face) 2161 2= 162 (fontified t font-lock-fontified t font-lock-multiline t face nil) 2162= 2182 (fontified t font-lock-fontified t font-lock-multiline t face nil) 21= 82 2183 (fontified t font-lock-fontified t font-lock-multiline t face py-va= riable-name-face) 2183 2187 (fontified t font-lock-fontified t font-lock-mu= ltiline t face py-variable-name-face) 2187 2188 (fontified t font-lock-font= ified t font-lock-multiline t face nil) 2188 2201 (fontified t font-lock-fo= ntified t font-lock-multiline t face nil) 2201 2202 (fontified t font-lock-= fontified t font-lock-multiline t face font-lock-string-face) 2202 2205 (fo= ntified t font-lock-fontified t font-lock-multiline t face font-lock-string= -face) 2205 2206 (fontified t font-lock-fontified t font-lock-multiline t f= ace nil) 2206 2207 (fontified t font-lock-fontified t font-lock-multiline t= face font-lock-string-face) 2207 2264 (fontified t font-lock-fontified t f= ont-lock-multiline t face font-lock-string-face) 2264 2265 (fontified t fon= t-lock-fontified t font-lock-multiline t face nil) 2265 2271 (fontified t f= ont-lock-fontified t font-lock-multiline t face nil) 2271 2272 (fontified t= font-lock-fontified t font-lock-multiline t face py-builtins-face) 2272 22= 77 (fontified t font-lock-fontified t font-lock-multiline t face py-builtin= s-face) 2277 2291 (fontified t font-lock-fontified t font-lock-multiline t)= 2291 2292 (fontified t font-lock-fontified t font-lock-multiline t) 2292 2= 304 (fontified t font-lock-fontified t font-lock-multiline t face org-block= -end-line) 2304 2305 (fontified t face org-block-end-line) 2305 6663 (fonti= fied nil) 6663 6664 (fontified t) 6664 6666 (fontified t face org-level-1) = 6666 6676 (fontified t face org-level-1) 6676 6683 (fontified t) 6683 6720 = (fontified t org-no-flyspell t mouse-face highlight face org-link keymap (k= eymap ... ... ...)) 6720 6721 (fontified t org-no-flyspell t mouse-face hig= hlight face org-link keymap (keymap ... ... ...) rear-nonsticky (mouse-face= highlight keymap invisible intangible help-echo org-linked-text)) 6721 672= 7 (fontified t) 6727 6807 (fontified t org-no-flyspell t mouse-face highlig= ht face org-link keymap (keymap ... ... ...)) 6807 6808 (fontified t org-no= -flyspell t mouse-face highlight face org-link keymap (keymap ... ... ...) = rear-nonsticky (mouse-face highlight keymap invisible intangible help-echo = org-linked-text)) 6808 6814 (fontified t) 6814 6860 (fontified t org-no-fly= spell t mouse-face highlight face org-link keymap (keymap ... ... ...)) 686= 0 6861 (fontified t org-no-flyspell t mouse-face highlight face org-link ke= ymap (keymap ... ... ...) rear-nonsticky (mouse-face highlight keymap invis= ible intangible help-echo org-linked-text)) 6861 6863 (fontified t)) :emph-= multiline t :for-backend html :skip-before-1st-heading nil :drawers nil :to= do-keywords t :tasks t :tags not-in-toc :priority nil :footnotes t :timesta= mps t :archived-trees headline :select-tags ("export") :exclude-t= ags ("noexport") :add-text nil :LaTeX-fragments t)
=A0 org-export-as-html(ni= l)
=A0 call-interactively(org-export-as-html)<= /span>
=A0 org-export(nil)
=A0 call-interactively(org-export nil nil)
I'm not sure what to make of it, though.
=A0=
> Strangely, doing an export for the 2nd time, without deleting the
> output html file manages to do it successfully without throwing any > errors.

There's a correction. On the first pass, no html file i= s generated. But I feel it must have something to do with the Python shell = buffers that get created (and are left with the comint:run status) after ea= ch export.
=A0

Which seems to hint at some undeclared variable that is brought into<= br> scope by the first run.


Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+<= br>
Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds



than= ks for the prompt response.

--
Sankalp


******************************<= span>*************************
If humans could mate with software, I'd have org-mode's
babies.
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 --- Chris League on Twitter.
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0http://orgmode.org/worg/org-quotes.html
*******************************************************
=

--f46d044287a6b1387e04bbb4b19a--