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


Groups > comp.lang.python > #72114

Re: Regular Expression for the special character "|" pipe

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'string.': 0.05; 'string': 0.09; 'escape': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'backslashes': 0.16; 'notation': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:Regular': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header :User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header :In-Reply-To:1': 0.27; 'about.': 0.31; 'pipe': 0.31; 'regular': 0.32; 'raw': 0.33; 'subject:the': 0.34; 'thanks': 0.36; 'saves': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'expression': 0.60; 'more': 0.64; 'talking': 0.65; 'response.': 0.68; 'skip:r 40': 0.68
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
Subject Re: Regular Expression for the special character "|" pipe
Date Tue, 27 May 2014 13:55:58 +0200
References <9c8e58be-9619-44c7-8098-961a0134c422@googlegroups.com> <CAHzaPEPqruhi57cK5BQt0roRRkqKOfgAdM5Yoe-stM+Ta5FB9w@mail.gmail.com> <mailman.10369.1401190577.18130.python-list@python.org> <3cc77455-39ed-4403-a46c-5dd8e640a483@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host bio-192-52-35-237.mobile.uni-freiburg.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
In-Reply-To <3cc77455-39ed-4403-a46c-5dd8e640a483@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10370.1401191774.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401191774 news.xs4all.nl 2841 [2001:888:2000:d::a6]:35648
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72114

Show key headers only | View raw


On 27.05.2014 13:39, Aman Kashyap wrote:
>> On 27.05.2014 14:09, Vlastimil Brom wrote:
>>
>>> you can just escpape the pipe with backlash like any other metacharacter:
>>>
>>> r"start=\|ID=ter54rt543d"
>>>
>>> be sure to use the raw string notation r"...", or you can double all
>>
>>> backslashes in the string.
>>
> Thanks for the response.
>
> I got the answer finally.
>
> This is the regular expression to be used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\|
>

or, and more readable:

r'\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\|'

This is what Vlastimil was talking about. It saves you from having to 
escape the backslashes.

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


Thread

Regular Expression for the special character "|" pipe Aman Kashyap <amankashyap1223@gmail.com> - 2014-05-27 03:59 -0700
  Re: Regular Expression for the special character "|" pipe Vlastimil Brom <vlastimil.brom@gmail.com> - 2014-05-27 13:09 +0200
    Re: Regular Expression for the special character "|" pipe Aman Kashyap <amankashyap1223@gmail.com> - 2014-05-27 04:20 -0700
  Re: Regular Expression for the special character "|" pipe Daniel <5960761@gmail.com> - 2014-05-27 14:29 +0300
    Re: Regular Expression for the special character "|" pipe Aman Kashyap <amankashyap1223@gmail.com> - 2014-05-27 04:39 -0700
      Re: Regular Expression for the special character "|" pipe Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-05-27 13:55 +0200
        Re: Regular Expression for the special character "|" pipe Roy Smith <roy@panix.com> - 2014-05-27 08:35 -0400
      Re: Regular Expression for the special character "|" pipe Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-27 14:06 +0100

csiph-web