Staging
v0.5.1
https://github.com/python/cpython
Revision 080daa04f1636224f2b0aeb34de80482a6d2496b authored by cvs2svn on 11 April 2000, 17:11:09 UTC, committed by cvs2svn on 11 April 2000, 17:11:09 UTC
1 parent 9144763
Raw File
Tip revision: 080daa04f1636224f2b0aeb34de80482a6d2496b authored by cvs2svn on 11 April 2000, 17:11:09 UTC
This commit was manufactured by cvs2svn to create tag 'r16a2'.
Tip revision: 080daa0
sre.py
# -*- Mode: Python; tab-width: 4 -*-
#
# Secret Labs' Regular Expression Engine
# $Id$
#
# re-compatible interface for the sre matching engine
#
# Copyright (c) 1998-2000 by Secret Labs AB.  All rights reserved.
#
# This code can only be used for 1.6 alpha testing.  All other use
# require explicit permission from Secret Labs AB.
#
# Portions of this engine have been developed in cooperation with
# CNRI.  Hewlett-Packard provided funding for 1.6 integration and
# other compatibility work.
#

"""
this is a long string
"""

import sre_compile

# --------------------------------------------------------------------
# public interface

def compile(pattern, flags=0):
    return sre_compile.compile(pattern, _fixflags(flags))

def match(pattern, string, flags=0):
    return compile(pattern, _fixflags(flags)).match(string)

def search(pattern, string, flags=0):
    assert flags == 0
    return compile(pattern, _fixflags(flags)).search(string)

# FIXME: etc

# --------------------------------------------------------------------
# helpers

def _fixflags(flags):
    # convert flag bitmask to sequence
    assert flags == 0
    return ()

back to top