Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #5916

[Python-de] Re: regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing"

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Christopher Arndt <chris@chrisarndt.de>
Newsgroups de.comp.lang.python
Subject [Python-de] Re: regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing"
Date Thu, 8 Dec 2022 09:04:03 +0100
Lines 15
Message-ID <0a215c75-fb0d-b27d-b4a1-5a643ec69df0@chrisarndt.de> (permalink)
References <6bee8c9e-6b66-fc98-9c4d-53f6d162afef@redcor.ch>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de lm8qe5T65b1v+s8mvOV+xwFuJN3ARvRjHoLy+NKQnFNA==
Authentication-Results mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=chrisarndt.de header.i=@chrisarndt.de header.b=J+EQIc0y; dkim-adsp=pass; dkim-atps=neutral
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisarndt.de; s=dkim; t=1670486644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qNw7tda/Go566/J0bgt7C9KXsPud+IbeS7k0ay0KnWI=; b=J+EQIc0yJc3VUTsAOg07DLHKq78yXC5wsNAxIPpDABwvBSpNVgXRYmyY3BVgpJN9dZMPCj r9S1SLRW1baUe1VdBz2kDlDFIjFCgDZKTHGJ5VZffE9W92bDvFrnw5DogaTrHPLiboYCrG x2Q1eQi71/xZ9RYy/AyxDMxv/ubLrfInOZ7KFayPBjgzJbZpC57oGr60LS21F7TC69h5DW CG03Br3B5YpV30GTpVoaw5GK65GRU0bAhCiEPdvecJnsWRgIQ85jgMTn5nAKZW7j3mr59b LC/QRaxOASdlJPgOK/4zzyEoQwGes5pZS3GDlXcs1Fzx7ZxgnY4hyR8LDgSNOQ==
Content-Language en-US
In-Reply-To <6bee8c9e-6b66-fc98-9c4d-53f6d162afef@redcor.ch>
Authentication-Results mx1.0x20.eu; auth=pass smtp.mailfrom=chris@chrisarndt.de
X-Spamd-Bar /
Message-ID-Hash YZZ4TDAMGSE5XREKH6XZCRXEABPZ4QVJ
X-Message-ID-Hash YZZ4TDAMGSE5XREKH6XZCRXEABPZ4QVJ
X-MailFrom chris@chrisarndt.de
X-Mailman-Rule-Misses dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-python-de.python.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version 3.3.7
Precedence list
List-Id Die Deutsche Python Mailingliste <python-de.python.org>
Archived-At <https://mail.python.org/archives/list/python-de@python.org/message/YZZ4TDAMGSE5XREKH6XZCRXEABPZ4QVJ/>
List-Archive <https://mail.python.org/archives/list/python-de@python.org/>
List-Help <mailto:python-de-request@python.org?subject=help>
List-Owner <mailto:python-de-owner@python.org>
List-Post <mailto:python-de@python.org>
List-Subscribe <mailto:python-de-join@python.org>
List-Unsubscribe <mailto:python-de-leave@python.org>
Xref csiph.com de.comp.lang.python:5916

Show key headers only | View raw


Am 08.12.22 um 08:20 schrieb robert rottermann:
 > Muss ich noch irgend ein Flag setzen?
a) Du solltest Raw Strings verwenden:

regex = r"..."

b) Statt "\r\n" zu matchen, verwende re.MULTILINE und "^" und "$".

c) Regular expressions sind für so was nur bedingt geeignet, besser wäre 
es einen Parser zu definieren, z.B. mit PyParsing:

https://github.com/pyparsing/pyparsing/blob/master/examples/configParse.py

Chris

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[Python-de] regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing" robert rottermann <robert@redcor.ch> - 2022-12-08 08:20 +0100
  [Python-de] Re: regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing" Christopher Arndt <chris@chrisarndt.de> - 2022-12-08 09:04 +0100
    [Python-de] Re: regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing" Matthias Urlichs <matthias@urlichs.de> - 2022-12-09 17:41 +0100
  Re: [Python-de] regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing" "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2022-12-08 12:29 +0100
  [Python-de] Re: regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing" Stefan Schwarzer <sschwarzer@sschwarzer.net> - 2022-12-08 15:07 +0100
    Re: [Python-de] Re: regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing" "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2022-12-08 22:46 +0100
  [Python-de] Re: regex: Ausdruck matches wen auf einer Zeile, fails when "freespacing" Stefan Schwarzer <sschwarzer@sschwarzer.net> - 2022-12-08 15:14 +0100

csiph-web