blob: 79878b35c4a7e800ae4811d60e356c3cbadcc2f9 [file] [log] [blame]
Guido van Rossum7627c0d2000-03-31 14:58:54 +00001# -*- Mode: Python; tab-width: 4 -*-
2#
3# Secret Labs' Regular Expression Engine
4# $Id$
5#
6# re-compatible interface for the sre matching engine
7#
8# Copyright (c) 1998-2000 by Secret Labs AB. All rights reserved.
9#
10# This code can only be used for 1.6 alpha testing. All other use
11# require explicit permission from Secret Labs AB.
12#
13# Portions of this engine have been developed in cooperation with
14# CNRI. Hewlett-Packard provided funding for 1.6 integration and
15# other compatibility work.
16#
17
18"""
19this is a long string
20"""
21
22import sre_compile
23
24# --------------------------------------------------------------------
25# public interface
26
27def compile(pattern, flags=0):
28 return sre_compile.compile(pattern, _fixflags(flags))
29
30def match(pattern, string, flags=0):
31 return compile(pattern, _fixflags(flags)).match(string)
32
33def search(pattern, string, flags=0):
Guido van Rossum7627c0d2000-03-31 14:58:54 +000034 return compile(pattern, _fixflags(flags)).search(string)
35
36# FIXME: etc
37
38# --------------------------------------------------------------------
39# helpers
40
41def _fixflags(flags):
42 # convert flag bitmask to sequence
Guido van Rossum1b6aecb2000-05-02 15:52:33 +000043 assert not flags
Guido van Rossum7627c0d2000-03-31 14:58:54 +000044 return ()
45