About 343,660 results: "re.compile"
Page 9 of 50
Filter Results
Sources
Languages
Filter Results
Try Search On










  1. 
                        
  2. \title{\huge{A Brief Description of RE Module of Tinypy}}
  3. 
                        
  4. \section{What's re module for tinypy? How it works?}
  5. 
                        
  6. \large{tinypy is a minimalist implementation of python in 64k of code. re module for tinypy's goal is to supply tinypy a regular expression supporting just as Python does (We will refer this module as re4tinypy in following paragraphs, as convenience. However, don't get confused with the name, the actual module name is re, not re4tinypy!). It tries to be as compatible as possible, though some unremarkable differences still be there. This short article will try to describe the interface of re4tinypy. In addition, it will also state the differences with re4python, if necessary.}
  7. 
                        
  8. Okay, now let's talk about how re4tinypy works? In normal situation, you should compile out a {\em re obj} first, then you can {\em match} or {\em search} on this object. re4tinypy provide a module level function for this purpose, i.e., {\em re.compile()}.
  9. 
                        
  10. When you match or search on {\em re obj}, an {\em match obj} will be returned if the string matched against the pattern. Note that {\em match} is different with {\em search}, this will be explained in following paragraphs. For convenience, four module level functions are enclosed in re module name space, which are actually wrapper of {\em re obj}'s method counterparts. They are {\em re.search, re.match, re.split(),} and {\em re.findall()}, respectively.
  11. 
                        
  12. re4tinypy have five module level functions, {\em re.compile(), re.search(), re.match(), re.split(),} and {\em re.findall()}. Four constances are defined in module level, too. They are {\em re.AWK\_SYNTAX, re.EGREP\_SYNTAX, re.GREP\_SYNTAX, re.EMACS\_SYNTAX}.
  13. 
                        
  14. re.compile({\em pattern [,syntax=EMACS\_SYNTAX]})
  15. 
                        
  16. compile {\em pattern} to re4tinypy's internal representation. {\em syntax} argument is optional, in default, its value is {\em EMACS\_SYNTAX}, meaning emacs regular expression syntax is used. If the internal representation is compiled out successfully, a {\em re obj} will be returned, otherwise {\em None}.









Back to Top