Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.python Subject: re.DOTALL Date: 17 Jul 2024 18:09:51 GMT Organization: Stefan Ram Lines: 41 Expires: 1 Jul 2025 11:59:58 GMT Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de ExymEG69DwOnJlZGk+XZIwotiL6PbIB8CdsaO2gm5ZMJyg Cancel-Lock: sha1:uro6JHqML636gjnMoEjX8CMfjwU= sha256:w3jQq5sYZjyDQ69/+KdH5SEAD7wcBZHZsV28i76SLHs= X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Bytes: 2035 Below, I use [\s\S] to match each and every character. I can't seem to get the same effect using "re.DOTALL"! Yet the Python Library Reference says, |(Dot.) In the default mode, this matches any character except |a newline. If the DOTALL flag has been specified, this |matches any character including a newline. what the Python Library Reference says. main.py import re text = ''' alpha
gamma
epsilon '''[ 1: -1 ] pattern = r'^.*?\n gamma
epsilon