blob: 0b4105721f2622d6e971444aaf867d4d8b6a9226 [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):
34 assert flags == 0
35 return compile(pattern, _fixflags(flags)).search(string)
36
37# FIXME: etc
38
39# --------------------------------------------------------------------
40# helpers
41
42def _fixflags(flags):
43 # convert flag bitmask to sequence
44 assert flags == 0
45 return ()
46