[Tutor] Regular expression on python

Alan Gauld alan.gauld at btinternet.com
Wed Apr 15 17:57:49 CEST 2015


On 15/04/15 09:24, Peter Otten wrote:

>> function call. I've never seen (or noticed?) the embedded form,
>> and don't see it described in the docs anywhere
>
> Quoting <https://docs.python.org/dev/library/re.html>:
>
> """
> (?aiLmsux)
> (One or more letters from the set 'a', 'i', 'L', 'm', 's', 'u', 'x'.) The
> group matches the empty string; the letters set the corresponding flags:

Aha. The trick is knowing the correct search string... I tried 'flag' 
and 'verbose' but missed this entry.

>> Again, where is that described?
>
> """
> (?#...)
> A comment; the contents of the parentheses are simply ignored.
> """

OK, I missed that too.
Maybe I just wasn't awake enough this morning! :-)

Thanks Peter.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list