Changeset 928 for ZMS/trunk/_globals.py


Ignore:
Timestamp:
09.03.2010 22:48:14 (2 years ago)
Author:
zmsdev
Message:

Added support for comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ZMS/trunk/_globals.py

    r927 r928  
    634634 
    635635""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     636_globals.re_sub: 
     637""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     638def re_sub( self, pattern, replacement, subject, ignorecase=False): 
     639  """ 
     640  Performs a search-and-replace across subject, replacing all matches of  
     641  regex in subject with replacement. The result is returned by the sub()  
     642  function. The subject string you pass is not modified. 
     643  @rtype: C{string} 
     644  """ 
     645  if ignorecase: 
     646    return re.compile( pattern, re.IGNORECASE).sub( replacement, subject) 
     647  else: 
     648    return re.compile( pattern).sub( replacement, subject) 
     649 
     650""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    636651_globals.re_search: 
    637652""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     
    844859    return http_import( self, url, method, auth, parse_qs) 
    845860 
     861  def re_sub( self, pattern, replacement, subject, ignorecase=False): 
     862    return re_sub( self, pattern, replacement, subject, ignorecase=False) 
     863 
    846864  def re_search( self, pattern, subject, ignorecase=False): 
    847865    return re_search( self, pattern, subject, ignorecase) 
Note: See TracChangeset for help on using the changeset viewer.