Re: Content filter and regex flags

Chris Olds <[email protected]> Thu, 27 Nov 2003 01:15:31 -0500 (EST)
Newsgroups gmane.comp.web.mod-pubsub.devel
Message-ID <[email protected]>
On Thu, 27 Nov 2003, Robert Leftwich wrote:
>
> At 09:01 AM 27/11/2003, Kragen Sitaker wrote:
> 
> >On Thu, Nov 27, 2003 at 08:03:34AM +1100, Robert Leftwich wrote:
> > > I'm using kn_content_filter to specify some server-side filtering and in
> > > some cases the filter regex will only work if some additional flags are
> > > specified when compiling it (e.g. DOTALL, MULTILINE mode, etc). To do this
> > > I added a new kn_content_filter_flags element which can be used to specify
> > > the required combination of flags (in integer form) which, if present, is
> > > passed to the call to re.compile() in pubsub.py.
> >
> >Can't you just use "(?m:some$^regex)"?
> 
> I wasn't aware that the Python regex engine supported the embedded modifer 
> syntax, but a bit of testing showed otherwise. Interestingly there is no 
> mention of that support in the Python doco.

For the archives, the RE syntax page (4.2.1 Regular Expression Syntax,
lib/re-syntax.html) does mention it, although it isn't very prominent. 
Search for "(?iLmsux)" to find it.

	/cco




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/