Given this string:
>>> s = """|Type=Foo
... |Side=Left"""
>>> print s
|Type=Foo
|Side=Left
I can match with this:
>>> m = re.search(r'^\|Type=(.*)$\n^\|Side=(.*)$',s,re.MULTILINE)
>>> print m.group(0)
|Type=Foo
|Side=Left
>>> print m.group(1)
Foo
>>> print m.group(2)
Left
But when I try and
On 2016-02-11 02:48, Larry Martell wrote:
Given this string:
s = """|Type=Foo
... |Side=Left"""
print s
|Type=Foo
|Side=Left
I can match with this:
m = re.search(r'^\|Type=(.*)$\n^\|Side=(.*)$',s,re.MULTILINE)
print m.group(0)
|Type=Foo
|Side=Left
print m.group(1)
Foo
print
On Wed, Feb 10, 2016 at 10:00 PM, MRAB wrote:
> On 2016-02-11 02:48, Larry Martell wrote:
>>
>> Given this string:
>>
> s = """|Type=Foo
>>
>> ... |Side=Left"""
>
> print s
>>
>> |Type=Foo
>> |Side=Left
>>
>> I can match with this:
>>
> m =
On 2016-02-11 03:09, Larry Martell wrote:
On Wed, Feb 10, 2016 at 10:00 PM, MRAB wrote:
On 2016-02-11 02:48, Larry Martell wrote:
Given this string:
s = """|Type=Foo
... |Side=Left"""
print s
|Type=Foo
|Side=Left
I can match with this:
m =
Well it seems that we are considerably closer to a solution to the GG
double-spaced crap problem.
Just wondering if someone can suggest a cleanup of the regexp part
Currently I have (elisp)
(defun clean-gg ()
(interactive)
1 (replace-regexp ^ *\n *\n *$ -=\=- nil 0 (point-max))
2
On Thursday, October 31, 2013 12:56:49 AM UTC+8, rusi wrote:
Well it seems that we are considerably closer to a solution to the GG
double-spaced crap problem.
Just wondering if someone can suggest a cleanup of the regexp part
Currently I have (elisp)
(defun clean-gg ()
Hello all,
I'm trying to write regexp that find all files that are not with next
extensions: exe|dll|ocx|py, but can't find any command that make it.
Please, help me
Nadav
--
http://mail.python.org/mailman/listinfo/python-list
2009/11/4 Nadav Chernin nada...@qualisystems.com:
I’m trying to write regexp that find all files that are not with next
extensions: exe|dll|ocx|py, but can’t find any command that make it.
http://code.activestate.com/recipes/499305/ should be a good start.
Use the re module and your regex
Thanks, but my question is how to write the regex.
-Original Message-
From: simon.brunn...@gmail.com [mailto:simon.brunn...@gmail.com] On Behalf Of
Simon Brunning
Sent: ד 04 נובמבר 2009 18:44
To: Nadav Chernin; Python List
Subject: Re: regexp help
2009/11/4 Nadav Chernin nada
2009/11/4 Nadav Chernin nada...@qualisystems.com:
Thanks, but my question is how to write the regex.
re.match(r'.*\.(exe|dll|ocx|py)$', the_file_name) works for me.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
Nadav Chernin wrote:
Thanks, but my question is how to write the regex.
See http://www.amk.ca/python/howto/regex/ .
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list
No, I need all files except exe|dll|ocx|py
-Original Message-
From: simon.brunn...@gmail.com [mailto:simon.brunn...@gmail.com] On Behalf Of
Simon Brunning
Sent: ד 04 נובמבר 2009 19:13
To: Nadav Chernin
Cc: Python List
Subject: Re: regexp help
2009/11/4 Nadav Chernin nada
2009/11/4 Nadav Chernin nada...@qualisystems.com:
No, I need all files except exe|dll|ocx|py
not re.match(r'.*\.(exe|dll|ocx|py)$', the_file_name)
Now that wasn't so hard, was it? ;-)
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
Simon Brunning wrote:
2009/11/4 Nadav Chernin nada...@qualisystems.com:
Thanks, but my question is how to write the regex.
re.match(r'.*\.(exe|dll|ocx|py)$', the_file_name) works for me.
How about:
os.path.splitext(x)[1] in (.exe, .dll, .ocx, .py):
DaveA
--
If I were using the code:
(?Pdata[0-9]+)
to get an integer between 0 and 9, how would I allow it to register
negative integers as well?
--
http://mail.python.org/mailman/listinfo/python-list
You can use r[+-]?\d+ to get positive and negative integers.
It returns true to these strings: +123, -123, 123
On Thu, Aug 27, 2009 at 3:15 PM, Bakes ba...@ymail.com wrote:
If I were using the code:
(?Pdata[0-9]+)
to get an integer between 0 and 9, how would I allow it to register
On Thu, 27 Aug 2009 11:15:59 -0700 (PDT), Bakes ba...@ymail.com wrote:
If I were using the code:
(?Pdata[0-9]+)
to get an integer between 0 and 9, how would I allow it to register
negative integers as well?
(?Pdata-?[0-9]+)
--
To email me, substitute nowhere-spamcop, invalid-net.
--
On Aug 27, 7:15 pm, Bakes ba...@ymail.com wrote:
If I were using the code:
(?Pdata[0-9]+)
to get an integer between 0 and 9, how would I allow it to register
negative integers as well?
-?
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 27, 1:15 pm, Bakes ba...@ymail.com wrote:
If I were using the code:
(?Pdata[0-9]+)
to get an integer between 0 and 9, how would I allow it to register
negative integers as well?
With that + sign in there, you will actually get an integer from 0 to
9...
-- Paul
--
Le Wednesday 11 June 2008 06:20:14 cirfu, vous avez écrit :
pat = re.compile((\w* *)*)
this matches all sentences.
if fed the string are you crazy? i am it will return are you
crazy.
i want to find a in a big string a sentence containing Zlatan
Ibrahimovic and some other text.
ie return
Le Wednesday 11 June 2008 09:08:53 Maric Michaud, vous avez écrit :
this is zlatan example.'
compare with 'this is zlatan example', 'z'=='.', false
compare with 'this is zlatan ', 'z'=='e', false
compare with 'this is zlatan', 'z'==' ', false
compare with 'this is ', zlatan==zlatan, true
Ah
On Jun 11, 6:20 am, cirfu [EMAIL PROTECTED] wrote:
pat = re.compile((\w* *)*)
this matches all sentences.
if fed the string are you crazy? i am it will return are you
crazy.
i want to find a in a big string a sentence containing Zlatan
Ibrahimovic and some other text.
ie return the first
On 12:20, mercoledì 11 giugno 2008 cirfu wrote:
patzln = re.compile((\w* *)* zlatan ibrahimovic (\w* *)*)
I think that I shouldn't put anything around the phrase you want to find.
patzln = re.compile(r'.*(zlatan ibrahimovic){1,1}.*')
this should do it for you. Unless searching into a special
On Tue, 10 Jun 2008 21:20:14 -0700 (PDT), cirfu [EMAIL PROTECTED] wrote:
pat = re.compile((\w* *)*)
this matches all sentences.
if fed the string are you crazy? i am it will return are you
crazy.
i want to find a in a big string a sentence containing Zlatan
Ibrahimovic and some other text.
On 11 Juni, 17:04, TheSaint [EMAIL PROTECTED] wrote:
On 12:20, mercoledì 11 giugno 2008 cirfu wrote:
patzln = re.compile((\w* *)* zlatan ibrahimovic (\w* *)*)
I think that I shouldn't put anything around the phrase you want to find.
patzln = re.compile(r'.*(zlatan ibrahimovic){1,1}.*')
On 11 Juni, 10:25, Chris [EMAIL PROTECTED] wrote:
On Jun 11, 6:20 am, cirfu [EMAIL PROTECTED] wrote:
pat = re.compile((\w* *)*)
this matches all sentences.
if fed the string are you crazy? i am it will return are you
crazy.
i want to find a in a big string a sentence containing Zlatan
On Jun 11, 11:07 pm, cirfu [EMAIL PROTECTED] wrote:
On 11 Juni, 10:25, Chris [EMAIL PROTECTED] wrote:
On Jun 11, 6:20 am, cirfu [EMAIL PROTECTED] wrote:
pat = re.compile((\w* *)*)
this matches all sentences.
if fed the string are you crazy? i am it will return are you
crazy.
pat = re.compile((\w* *)*)
this matches all sentences.
if fed the string are you crazy? i am it will return are you
crazy.
i want to find a in a big string a sentence containing Zlatan
Ibrahimovic and some other text.
ie return the first sentence containing the name Zlatan Ibrahimovic.
patzln =
i want to a little stringmanipulationa nd im looking into regexps. i
couldnt find out how to do:
s = 'poprorinoncoce'
re.sub('$o$', '$', s)
should result in 'prince'
$ is obv the wrng character to use bu what i mean the pattern is
consonant o consonant and should be replace by just consonant.
On May 9, 5:19 pm, globalrev [EMAIL PROTECTED] wrote:
i want to a little stringmanipulationa nd im looking into regexps. i
couldnt find out how to do:
s = 'poprorinoncoce'
re.sub('$o$', '$', s)
should result in 'prince'
$ is obv the wrng character to use bu what i mean the pattern is
On May 9, 3:19 pm, globalrev [EMAIL PROTECTED] wrote:
i want to a little stringmanipulationa nd im looking into regexps. i
couldnt find out how to do:
s = 'poprorinoncoce'
re.sub('$o$', '$', s)
should result in 'prince'
$ is obv the wrng character to use bu what i mean the pattern is
Paul McGuire wrote:
from re import *
Perhaps you intended import re.
vowels = aAeEiIoOuU
cons = bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ
encodeRe = re.compile(r([%s])[%s]\1 % (cons,vowels))
print encodeRe.sub(r\1,s)
This is actually a little more complex than you asked - it will search
ty. that was the decrypt function. i am slo writing an encrypt
function.
def encrypt(phrase):
pattern =
re.compile(r([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]))
return pattern.sub(r1\o\1, phrase)
doesnt work though, h becomes 1\\oh.
def encrypt(phrase):
pattern =
globalrev wrote:
ty. that was the decrypt function. i am slo writing an encrypt
function.
def encrypt(phrase):
pattern =
re.compile(r([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]))
The inner pair of () are not necessary.
return pattern.sub(r1\o\1, phrase)
doesnt work though, h
The inner pair of () are not necessary.
yes they are?
ty anyway, got it now.
--
http://mail.python.org/mailman/listinfo/python-list
globalrev wrote:
The inner pair of () are not necessary.
yes they are?
You are correct. I was having a flashback to a dimly remembered previous
incarnation during which I used regexp software in which something like
or \0 denoted the whole match (like MatchObject.group(0)) :-)
--
On May 9, 6:52 pm, John Machin [EMAIL PROTECTED] wrote:
Paul McGuire wrote:
from re import *
Perhaps you intended import re.
Indeed I did.
snip
Both print prince.
No they don't. The result is NameError: name 're' is not defined.
Dang, now how did that work in my script? I assure you
On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote:
I'm wrapping up a command line util that returns xml in Python. The
util is flaky, and gives me back poorly formed xml with different
problems in different cases. Anyway I'm making progress. I'm not
very good at regular expressions
On Dec 14, 12:04 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote:
I'm wrapping up a command line util that returns xml in Python. The
util is flaky, and gives me back poorly formed xml with different
problems in different cases.
En Fri, 14 Dec 2007 06:06:21 -0300, Sean DiZazzo [EMAIL PROTECTED]
escribió:
On Dec 14, 12:04 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote:
I'm wrapping up a command line util that returns xml in Python. The
util is flaky,
On Dec 14, 3:06 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Fri, 14 Dec 2007 06:06:21 -0300, Sean DiZazzo [EMAIL PROTECTED]
escribió:
On Dec 14, 12:04 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Thu, 13 Dec 2007 17:49:20 -0800, Sean DiZazzo wrote:
I'm wrapping up a
Hi group,
I'm wrapping up a command line util that returns xml in Python. The
util is flaky, and gives me back poorly formed xml with different
problems in different cases. Anyway I'm making progress. I'm not
very good at regular expressions though and was wondering if someone
could help with
On Dec 13, 5:49 pm, Sean DiZazzo [EMAIL PROTECTED] wrote:
Hi group,
I'm wrapping up a command line util that returns xml in Python. The
util is flaky, and gives me back poorly formed xml with different
problems in different cases. Anyway I'm making progress. I'm not
very good at regular
43 matches
Mail list logo