On Thu, Mar 2, 2023 at 9:56 PM Alan Bawden wrote:
>
> jose isaias cabrera writes:
>
>On Thu, Mar 2, 2023 at 2:38 PM Mats Wichmann wrote:
>
>This re is a bit different than the one I am used. So, I am trying to match
>everything after 'pn=':
>
>import re
>s = "pm=jose pn=2017"
ject manager. pn=project name. I needed search()
rather than match().
>
> >>> s = "pn=jose pn=2017"
> ...
> >>> s0 = r0.match(s)
> >>> s0
>
>
>
>
> -Original Message-
> From: Python-list On
> Behalf Of jose isaias cab
On Thu, Mar 2, 2023 at 8:30 PM Cameron Simpson wrote:
>
> On 02Mar2023 20:06, jose isaias cabrera wrote:
> >This re is a bit different than the one I am used. So, I am trying to
> >match
> >everything after 'pn=':
> >
> >import re
> >s = "pm=jose pn=2017"
> >m0 = r"pn=(.+)"
> >r0 = re.compile(m0)
jose isaias cabrera writes:
On Thu, Mar 2, 2023 at 2:38 PM Mats Wichmann wrote:
This re is a bit different than the one I am used. So, I am trying to match
everything after 'pn=':
import re
s = "pm=jose pn=2017"
m0 = r"pn=(.+)"
r0 = re.compile(m0)
s0 = r0.match(s)
>>
On 02Mar2023 20:06, jose isaias cabrera wrote:
This re is a bit different than the one I am used. So, I am trying to
match
everything after 'pn=':
import re
s = "pm=jose pn=2017"
m0 = r"pn=(.+)"
r0 = re.compile(m0)
s0 = r0.match(s)
`match()` matches at the start of the string. You want r0.se
;> s0
-Original Message-
From: Python-list On
Behalf Of jose isaias cabrera
Sent: Thursday, March 2, 2023 8:07 PM
To: Mats Wichmann
Cc: python-list@python.org
Subject: Re: Regular Expression bug?
On Thu, Mar 2, 2023 at 2:38 PM Mats Wichmann wrote:
>
> On 3/2/23 12:28
On Thu, Mar 2, 2023 at 2:38 PM Mats Wichmann wrote:
>
> On 3/2/23 12:28, Chris Angelico wrote:
> > On Fri, 3 Mar 2023 at 06:24, jose isaias cabrera
wrote:
> >>
> >> Greetings.
> >>
> >> For the RegExp Gurus, consider the following python3 code:
> >>
> >> import re
> >> s = "pn=align upgrade sd=2
José,
Matching can be greedy. Did it match to the last space?
What you want is a pattern that matches anything except a space (or whitespace)
followed b matching a space or something similar.
Or use a construct that makes matching non-greedy.
Avi
-Original Message-
From: Python-list
On Thu, Mar 2, 2023 at 2:32 PM <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2023-03-02 at 14:22:41 -0500,
> jose isaias cabrera wrote:
>
> > For the RegExp Gurus, consider the following python3 code:
> >
> > import re
> > s = "pn=align upgrade sd=2023-02-"
> > ro = re.compile(r"pn=(.+) ")
>
On 3/2/23 12:28, Chris Angelico wrote:
On Fri, 3 Mar 2023 at 06:24, jose isaias cabrera wrote:
Greetings.
For the RegExp Gurus, consider the following python3 code:
import re
s = "pn=align upgrade sd=2023-02-"
ro = re.compile(r"pn=(.+) ")
r0=ro.match(s)
print(r0.group(1))
align upgrade
T
On 2023-03-02 at 14:22:41 -0500,
jose isaias cabrera wrote:
> For the RegExp Gurus, consider the following python3 code:
>
> import re
> s = "pn=align upgrade sd=2023-02-"
> ro = re.compile(r"pn=(.+) ")
> r0=ro.match(s)
> >>> print(r0.group(1))
> align upgrade
>
>
> This is wrong. It should be
On Fri, 3 Mar 2023 at 06:24, jose isaias cabrera wrote:
>
> Greetings.
>
> For the RegExp Gurus, consider the following python3 code:
>
> import re
> s = "pn=align upgrade sd=2023-02-"
> ro = re.compile(r"pn=(.+) ")
> r0=ro.match(s)
> >>> print(r0.group(1))
> align upgrade
>
>
> This is wrong. I
On Mon, Oct 29, 2018 at 05:16:11PM +, MRAB wrote:
> > Logically it should not because
> >
> > >s'::15>>$
> >
> > does not match
> >
> > ::\d*>>$
> >
> > but I am not sure how to tell it that :-)
> >
> For something like that, I'd use parsing by recursive descent.
>
> It might be
On 2018-10-29 08:02, Karsten Hilbert wrote:
On Sun, Oct 28, 2018 at 11:14:15PM +, MRAB wrote:
> - lines can contain several placeholders
>
> - placeholders start and end with '$'
>
> - placeholders are parsed in three passes
>
> - the pass in which a placeholder is parsed is denoted by t
On Sun, Oct 28, 2018 at 11:57:48PM +0100, Brian Oney wrote:
> On Sun, 2018-10-28 at 22:04 +0100, Karsten Hilbert wrote:
> > [^<:]
>
> Would a simple regex work?
This brought about the solution.
However, not this way:
> >>> import re
> >>> t = '$$'
> >>> re.findall('[^<>:$]+', t)
> ['name', 'op
> Right, I am not trying to do that. I was, however, worried
> that I need to make the expression not "trip over" fragments
> of what might seem to constitute part of another placeholder.
>
> $<$::15>>$
>
> Pass 1 might fill in to:
>
> $>$
>
> and I was worried to make sure
On Mon, Oct 29, 2018 at 12:10:04AM +0100, Thomas Jollans wrote:
> On 28/10/2018 22:04, Karsten Hilbert wrote:
> > - options needs to be able to contain nearly anything, except '::'
>
> Including > and $ ?
Unfortunately, it might. Even if I assume that earlier passes
are "inside", and thusly "fil
On Sun, Oct 28, 2018 at 11:14:15PM +, MRAB wrote:
> > - lines can contain several placeholders
> >
> > - placeholders start and end with '$'
> >
> > - placeholders are parsed in three passes
> >
> > - the pass in which a placeholder is parsed is denoted by the number of '<'
> > and '>' nex
On 28/10/2018 22:04, Karsten Hilbert wrote:
> - options needs to be able to contain nearly anything, except '::'
Including > and $ ?
--
https://mail.python.org/mailman/listinfo/python-list
On 28/10/2018 22:04, Karsten Hilbert wrote:
> - options needs to be able to contain nearly anything, except '::'
>
> Is that sufficiently defined and helpful to design the regular expression ?
so options isn't '.*', but more like '(:?[^:]+)*' (Figuring out what
additional restriction this imposes
On 2018-10-28 21:04, Karsten Hilbert wrote:
On Sun, Oct 28, 2018 at 09:43:27PM +0100, Karsten Hilbert wrote:
Let my try to explain the expression I am actually after
(assuming .compile with re.VERBOSE):
rx_works = '
\$< # start of match is literal '$<' anywhere
On Sun, 2018-10-28 at 22:04 +0100, Karsten Hilbert wrote:
> [^<:]
Would a simple regex work?
I mean:
~$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> t = '$$'
>>> re.f
On Sun, Oct 28, 2018 at 10:04:39PM +0100, Karsten Hilbert wrote:
> - options needs to be able to contain nearly anything, except '::'
This seems to contradict the "nesting" requirement, but the
nesting restriction "earlier parsing passes go inside" makes
it possible.
Karsten
--
GPG 40BE 5B0E C
On Sun, Oct 28, 2018 at 09:43:27PM +0100, Karsten Hilbert wrote:
> Let my try to explain the expression I am actually after
> (assuming .compile with re.VERBOSE):
>
> rx_works = '
> \$< # start of match is literal '$<'
> anywhere inside string
> [^<:]+?::
Now that MRAB has shown me the follies of my ways I would
like to learn how to properly write the regular expression I
need.
This part:
> rx_works = '\$<[^<:]+?::.*?::\d*?>\$|\$<[^<:]+?::.*?::\d+-\d+>\$'
> # it fails if switched around:
> rx_fails = '\$<[^<:]+?::.*?::\d+-\d+>\$|\$<[^<:]+?::.*?::\
On 2018-10-28 18:51, Karsten Hilbert wrote:
Dear list members,
I cannot figure out why my regular expression does not work as I expect it to:
#---
#!/usr/bin/python
from __future__ import print_function
import re as regex
rx_works = '\$<[^<:]+?::.*?::\d*?>\$|\$<[^<:]+?
Kunal Jamdade writes:
> There is a filename say:- 'first-324-True-rms-kjhg-Meterc639.html' .
>
> I want to extract the last 4 characters. I tried different regex. but
> i am not getting it right.
>
> Can anyone suggest me how should i proceed.?
os.path.splitext(name) # most likely; also: os.path
fname = 'first-324-True-rms-kjhg-Meterc639.html'
# with string manipulation
stem, suffix = fname.rsplit('.', 1)
print(stem[-4:])
# oo-style with str manipulation
import pathlib
path = pathlib.Path(fname)
print(path.stem[-4:])
--
https://mail.python.org/mailman/listinfo/python-list
Kunal Jamdade wrote:
> There is a filename say:- 'first-324-True-rms-kjhg-Meterc639.html' .
>
> I want to extract the last 4 characters. I tried different regex. but i am
> not getting it right.
>
> Can anyone suggest me how should i proceed.?
You don't need a regular expression:
>>> import os
Is this what you are after?
*>>> *data = 'first-324-True-rms-kjhg-Meterc639.html'
*>>> *extension = data.find('.html')
*>>> *extension
33
*>>> *data[extension-4:extension]
'c639'
On 26 July 2017 at 13:00, Johann Spies wrote:
> On 26 July 2017 at 13:52, Kunal Jamdade wrote:
> > There is a
On 26 July 2017 at 13:52, Kunal Jamdade wrote:
> There is a filename say:- 'first-324-True-rms-kjhg-Meterc639.html' .
>
> I want to extract the last 4 characters. I tried different regex. but i am
> not getting it right.
>
> Can anyone suggest me how should i proceed.?
What have you tried?
Why d
2017-03-12 17:22 GMT+01:00 :
> Hi All,
>
> I have a string which looks like
>
> a,b,c "4873898374", d, ee "3343,23,23,5,,5,45", f
> "5546,3434,345,34,34,5,34,543,7"
>
> It is comma saperated string, but some of the fields have a double quoted
> string as part of it (and t
On 2017-03-12 09:22, rahulra...@gmail.com wrote:
> a,b,c "4873898374", d, ee "3343,23,23,5,,5,45",
> f "5546,3434,345,34,34,5,34,543,7"
>
> It is comma saperated string, but some of the fields have a double
> quoted string as part of it (and that double quoted string can ha
rahulra...@gmail.com writes:
> Hi All,
>
> I have a string which looks like
>
> a,b,c "4873898374", d, ee "3343,23,23,5,,5,45", f
> "5546,3434,345,34,34,5,34,543,7"
>
> It is comma saperated string, but some of the fields have a double
> quoted string as part of it (and th
On Sun, Mar 12, 2017 at 12:22 PM, wrote:
> Hi All,
>
> I have a string which looks like
>
> a,b,c "4873898374", d, ee "3343,23,23,5,,5,45", f
> "5546,3434,345,34,34,5,34,543,7"
>
> It is comma saperated string, but some of the fields have a double quoted
> string as part
MRAB wrote:
> On 2015-08-18 22:42, Laurent Pointal wrote:
>> Hello,
>> ellipfind_re = re.compile(r"((?=\.\.\.)|…)", re.IGNORECASE|re.VERBOSE)
>> ellipfind_re.sub(' ... ',
>> "C'est un essai... avec différents caractères… pour voir.")
> (?=...) is a lookahead; a non-capture group is (?:..
On 2015-08-18 22:42, Laurent Pointal wrote:
Hello,
I want to make a replacement in a string, to ensure that ellipsis are
surrounded by spaces (this is not a typographycal problem, but a preparation
for late text chunking).
I tried with regular expressions and the SRE_Pattern.sub() method, but I
In a message of Thu, 04 Jun 2015 06:36:29 -0700, Palpandi writes:
>Hi All,
>
>This is the case. To split "string2" from "string1_string2" I am using
>re.split('_', "string1_string2", 1)
And you shouldn't be. The 3rd argument, 1 says stop after one match.
>It is working fine for string "string1_
Palpandi wrote:
> This is the case. To split "string2" from "string1_string2" I am using
> re.split('_', "string1_string2", 1)[1].
>
> It is working fine for string "string1_string2" and output as "string2".
> But actually the problem is that if a sting is "__string1_string2" and the
> output is
On 2015-06-04 06:36, Palpandi wrote:
> This is the case. To split "string2" from "string1_string2" I am
> using re.split('_', "string1_string2", 1)[1].
>
> It is working fine for string "string1_string2" and output as
> "string2". But actually the problem is that if a sting is
> "__string1_string2
On Thu, 4 Jun 2015 11:36 pm, Palpandi wrote:
> Hi All,
>
> This is the case. To split "string2" from "string1_string2" I am using
> re.split('_', "string1_string2", 1)[1].
There is absolutely no need to use the nuclear-powered bulldozer of regular
expressions to crack that tiny peanut. Strings
On Thu, Jun 4, 2015 at 9:36 AM, Palpandi wrote:
>
> Hi All,
>
> This is the case. To split "string2" from "string1_string2" I am using
> re.split('_', "string1_string2", 1)[1].
>
> It is working fine for string "string1_string2" and output as "string2". But
> actually the problem is that if a sti
I fixed all!
Thanks. This is the result:
#C[Health]
#P[Information]
#ST[genetic information]
#C[oral | (recorded in (any form | medium))]
#C[Is created or received by]
#A[health care provider | health plan | public health authority | employer |
life insurer | school | university | or health car
Sweet! Thanks all of you! I matched everything except these ones... trying to
find the best way
> whether #C[oral | (recorded in (any form | medium))], that
#C[the past, present, or future physical | mental health | condition of an
individual] |
> #C[the past, present, or future payment fo
> Put the print inside the "if"; you don't really care when result is None, and
> anyway you can't access .group when it is None - it is not an 're.match"
> object, because there was no match.
Thanks Cameron, this worked.
>
> Once you're happy you should consider what happens when there is m
On 12Apr2015 18:28, Pippo wrote:
On Sunday, 12 April 2015 21:21:48 UTC-4, Cameron Simpson wrote:
[...]
Pippo, please take a moment to trim the less relevant verbiage from the quoted
material; it makes replies easier to read because what is left can be taken to
be more "on point". Thanks.
On Sunday, 12 April 2015 21:21:48 UTC-4, Cameron Simpson wrote:
> On 12Apr2015 17:55, Pippo wrote:
> >On Sunday, 12 April 2015 20:46:19 UTC-4, Cameron Simpson wrote:
> >> It looks like it should, unless you have mangled your regular expression.
> [...]
> >> Also note that you can print the reg
On 12Apr2015 17:55, Pippo wrote:
On Sunday, 12 April 2015 20:46:19 UTC-4, Cameron Simpson wrote:
It looks like it should, unless you have mangled your regular expression.
[...]
Also note that you can print the regexp's .pattern attribute:
print(constraint.pattern)
as a check that what was
On Sunday, 12 April 2015 21:07:09 UTC-4, MRAB wrote:
> On 2015-04-13 01:55, Pippo wrote:
> > On Sunday, 12 April 2015 20:46:19 UTC-4, Cameron Simpson wrote:
> >> >> >> > > constraint = re.compile(r'(#C\[\w*\]'))
> >> >> >> > > result = constraint.search(content[j],re.MULTILINE)
> >> >>
On 2015-04-13 01:55, Pippo wrote:
On Sunday, 12 April 2015 20:46:19 UTC-4, Cameron Simpson wrote:
>> >> > > constraint = re.compile(r'(#C\[\w*\]'))
>> >> > > result = constraint.search(content[j],re.MULTILINE)
>> >> > > text.append(result)
>> >> > > print(text)
[...]
>> >> r
On 2015-04-13 01:25, Pippo wrote:
On Sunday, 12 April 2015 20:06:08 UTC-4, MRAB wrote:
On 2015-04-13 00:47, Pippo wrote:
> On Sunday, 12 April 2015 19:44:05 UTC-4, Pippo wrote:
>> On Sunday, 12 April 2015 19:28:44 UTC-4, MRAB wrote:
>> > On 2015-04-12 23:49, Pippo wrote:
>> > > I have a text
On Sunday, 12 April 2015 20:46:19 UTC-4, Cameron Simpson wrote:
> >> >> > > constraint = re.compile(r'(#C\[\w*\]'))
> >> >> > > result = constraint.search(content[j],re.MULTILINE)
> >> >> > > text.append(result)
> >> >> > > print(text)
> [...]
> >> >> result is empty! Although
On 12Apr2015 17:25, Pippo wrote:
>> > > constraint = re.compile(r'(#C\[\w*\]'))
>> > > result = constraint.search(content[j],re.MULTILINE)
>> > > text.append(result)
>> > > print(text)
[...]
>> result is empty! Although it should have a content.
[...]
> I fixed the syntax
On Sunday, 12 April 2015 20:06:08 UTC-4, MRAB wrote:
> On 2015-04-13 00:47, Pippo wrote:
> > On Sunday, 12 April 2015 19:44:05 UTC-4, Pippo wrote:
> >> On Sunday, 12 April 2015 19:28:44 UTC-4, MRAB wrote:
> >> > On 2015-04-12 23:49, Pippo wrote:
> >> > > I have a text as follows:
> >> > >
> >> >
On 2015-04-13 00:47, Pippo wrote:
On Sunday, 12 April 2015 19:44:05 UTC-4, Pippo wrote:
On Sunday, 12 April 2015 19:28:44 UTC-4, MRAB wrote:
> On 2015-04-12 23:49, Pippo wrote:
> > I have a text as follows:
> >
> > "#D{#C[Health] #P[Information] -
> > means any information, including #ST[genet
On Sunday, 12 April 2015 19:47:09 UTC-4, Pippo wrote:
> On Sunday, 12 April 2015 19:44:05 UTC-4, Pippo wrote:
> > On Sunday, 12 April 2015 19:28:44 UTC-4, MRAB wrote:
> > > On 2015-04-12 23:49, Pippo wrote:
> > > > I have a text as follows:
> > > >
> > > > "#D{#C[Health] #P[Information] -
> > >
On Sunday, 12 April 2015 19:44:05 UTC-4, Pippo wrote:
> On Sunday, 12 April 2015 19:28:44 UTC-4, MRAB wrote:
> > On 2015-04-12 23:49, Pippo wrote:
> > > I have a text as follows:
> > >
> > > "#D{#C[Health] #P[Information] -
> > > means any information, including #ST[genetic information],
> > > wh
On Sunday, 12 April 2015 19:28:44 UTC-4, MRAB wrote:
> On 2015-04-12 23:49, Pippo wrote:
> > I have a text as follows:
> >
> > "#D{#C[Health] #P[Information] -
> > means any information, including #ST[genetic information],
> > whether #C[oral | (recorded in (any form | medium))], that
> > (1)#C[Is
Pippo writes:
> I try with regex but it doesn't work:
Thank you for providing a short, self-contained example.
What does this code do when you try? If there is an error, please post
the full traceback exactly (cut and paste the traceback text).
What are you expecting it to do, and how is that
On 2015-04-12 23:49, Pippo wrote:
I have a text as follows:
"#D{#C[Health] #P[Information] -
means any information, including #ST[genetic information],
whether #C[oral | (recorded in (any form | medium))], that
(1)#C[Is created or received by] a
#A[health care provider | health plan | public hea
On 27/05/2014 12:39, Aman Kashyap wrote:
On Tuesday, 27 May 2014 16:59:38 UTC+5:30, Daniel wrote:
What about skipping the re and try this:
'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:]
On 27.05.2014 14:09, Vlastimil Brom wrote:
2014-05-27 12:59 GMT+02:00 Aman Kashyap :
In article ,
Wolfgang Maier wrote:
> 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 notat
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
On Tuesday, 27 May 2014 16:59:38 UTC+5:30, Daniel wrote:
> What about skipping the re and try this:
>
>
>
> 'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:]
>
>
>
> On 27.05.2014 14:09, Vlastimil Brom wrote:
>
> > 2014-05-27 12:59 GMT+02:00 Aman Kashyap :
>
> >> I would like
What about skipping the re and try this:
'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:]
On 27.05.2014 14:09, Vlastimil Brom wrote:
2014-05-27 12:59 GMT+02:00 Aman Kashyap :
I would like to create a regular expression in which i can match the "|"
special character too.
e.g.
On Tuesday, 27 May 2014 16:39:19 UTC+5:30, Vlastimil Brom wrote:
> 2014-05-27 12:59 GMT+02:00 Aman Kashyap :
>
> > I would like to create a regular expression in which i can match the "|"
> > special character too.
>
> >
>
> > e.g.
>
> >
>
> > start=|ID=ter54rt543d|SID=ter54rt543d|end=|
>
>
2014-05-27 12:59 GMT+02:00 Aman Kashyap :
> I would like to create a regular expression in which i can match the "|"
> special character too.
>
> e.g.
>
> start=|ID=ter54rt543d|SID=ter54rt543d|end=|
>
> I want to only |ID=ter54rt543d| from the above string but i am unable to
> write the pattern
should have escaped hyphen as it could be used for ranging.
sorry for the bother...
From: y...@outlook.com
To: python-list@python.org
Subject: Regular Expression : Bad Character Range
Date: Thu, 19 Dec 2013 23:50:52 -0300
Hey guys,
I'm trying to compile a regular Expression while encounteri
Huh, did not realize that endswith takes a list. I'll remember that in the
future.
This need is actually for http://schemaspy.sourceforge.net/, which allows
one to include only tables/views that match a pattern.
Either there is a bug in Schemaspy's code or Java's implementation of
regular expres
> Huh, did not realize that endswith takes a list. I'll remember that in
> the future.
>
> This need is actually for http://schemaspy.sourceforge.net/, which allows
> one to include only tables/views that match a pattern.
>
> Either there is a bug in Schemaspy's code or Java's implementation of
>
On 2013-07-01, Jason Friedman wrote:
>
> I have table names in this form:
> MY_TABLE
> MY_TABLE_CTL
> MY_TABLE_DEL
> MY_TABLE_RUN
> YOUR_TABLE
> YOUR_TABLE_CTL
> YOUR_TABLE_DEL
> YOUR_TABLE_RUN
>
> I am trying to create a regular expression that will return true for only
> these tables:
> MY_TABLE
On Mon, Jul 1, 2013 at 8:27 PM, Jason Friedman wrote:
> Found this:
> http://stackoverflow.com/questions/13871833/negative-lookahead-assertion-not-working-in-python.
>
> This pattern seems to work:
> pattern = re.compile(r"^(?!.*(CTL|DEL|RUN))")
>
> But I am not sure why.
>
>
> On Mon, Jul 1, 2013
Found this:
http://stackoverflow.com/questions/13871833/negative-lookahead-assertion-not-working-in-python
.
This pattern seems to work:
pattern = re.compile(r"^(?!.*(CTL|DEL|RUN))")
But I am not sure why.
On Mon, Jul 1, 2013 at 5:07 PM, Jason Friedman wrote:
> I have table names in this form
On 3/11/2013 2:30 PM, Serhiy Storchaka wrote:
On 11.03.13 04:06, Terry Reedy wrote:
On 3/10/2013 1:42 PM, mukesh tiwari wrote:
Hello all
I am trying to solve this problem[1]
[1] http://www.spoj.com/problems/MAIN12C/
As I remember, and as it still appears, this site severely penalizes
Python s
On 11.03.13 04:06, Terry Reedy wrote:
On 3/10/2013 1:42 PM, mukesh tiwari wrote:
Hello all
I am trying to solve this problem[1]
[1] http://www.spoj.com/problems/MAIN12C/
As I remember, and as it still appears, this site severely penalizes
Python solvers by using the same time limit for all lan
On Mar 11, 2:28 pm, jmfauth wrote:
> On 11 mar, 03:06, Terry Reedy wrote:
>
>
>
> > ...
> > By teaching 'speed before correctness", this site promotes bad
> > programming habits and thinking (and the use of low-level but faster
> > languages).
> > ...
>
> This is exactly what "your" flexible stri
On 11/03/2013 09:28, jmfauth wrote:
On 11 mar, 03:06, Terry Reedy wrote:
...
By teaching 'speed before correctness", this site promotes bad
programming habits and thinking (and the use of low-level but faster
languages).
...
This is exactly what "your" flexible string representation
does!
On 11 mar, 03:06, Terry Reedy wrote:
>
> ...
> By teaching 'speed before correctness", this site promotes bad
> programming habits and thinking (and the use of low-level but faster
> languages).
> ...
This is exactly what "your" flexible string representation
does!
And away from technical aspe
On 3/10/2013 1:42 PM, mukesh tiwari wrote:
Hello all
I am trying to solve this problem[1]
[1] http://www.spoj.com/problems/MAIN12C/
As I remember, and as it still appears, this site severely penalizes
Python solvers by using the same time limit for all languages. Thus, a
'slow' python program
On Mon, Mar 11, 2013 at 5:48 AM, mukesh tiwari
wrote:
> Hi Chris
> Thank you! Now I am getting wrong answer so at least program is faster then
> previous one and I am looking for wrong answer reason. Thanks again!
Excellent! Have fun.
Incidentally, regular expressions aren't the only way to sol
Hi Chris
Thank you! Now I am getting wrong answer so at least program is faster then
previous one and I am looking for wrong answer reason. Thanks again!
import re
if __name__ == "__main__":
n = int ( raw_input() )
c = 1
while c <= n :
email = filter ( lambda x : x != None ,
Hi Chris
On the problem page, it is 3 second.
> What is the time limit? I just tried it (Python 2.6 under Windows) and
>
> it finished in a humanly-immeasurable amount of time. Are you sure
>
> that STDIN (eg raw_input()) is where your test data is coming from?
Yes, on SPOJ we read data from
On Mon, Mar 11, 2013 at 4:59 AM, Chris Angelico wrote:
> On Mon, Mar 11, 2013 at 4:42 AM, mukesh tiwari
> wrote:
>> I am trying to solve this problem[1] using regular expression. I wrote this
>> code but I am getting time limit exceed. Could some one please tell me how
>> to make this code run
On Mon, Mar 11, 2013 at 4:42 AM, mukesh tiwari
wrote:
> I am trying to solve this problem[1] using regular expression. I wrote this
> code but I am getting time limit exceed. Could some one please tell me how to
> make this code run faster.
What is the time limit? I just tried it (Python 2.6 un
On Mon, 07 Jan 2013 01:45:58 -0800, iMath wrote:
> 在 2012年9月26日星期三UTC+8下午3时38分50秒,iMath写道:
>> I only know the dollar sign ($) will match a pattern from the
>>
>> end of a string,but which method does it work with ,re.match() or
>> re.search() ?
>
> I thought re.match('h.$', 'hbxihi') will matc
在 2012年9月26日星期三UTC+8下午3时38分50秒,iMath写道:
> I only know the dollar sign ($) will match a pattern from the
>
> end of a string,but which method does it work with ,re.match() or re.search()
> ?
I thought re.match('h.$', 'hbxihi') will match ‘hi’ ,but it does not .so why ?
--
http://mail.python.or
On 01/03/2013 12:39 PM, Peter Otten wrote:
someone wrote:
On 01/03/2013 10:00 AM, Peter Otten wrote:
Terry Reedy wrote:
[a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with
[an
underscore ?
No, it allows underscores. As I read that re, 'rx', etc, do match. They
No, it's
On Monday, November 26, 2012 8:34:22 AM UTC-8, Michael Torrie wrote:
> http://pypi.python.org/pypi/python-dateutil
> ...
> I don't believe the library is updated for Python 3 yet, sadly.
dateutil supports 3.x since version 2.0.
--
http://mail.python.org/mailman/listinfo/python-list
On 11/26/2012 06:15 AM, undesputed.hack...@gmail.com wrote:
> I am a beginner in python and need help with writing a regular
> expression for date and time to be fetched from some html documents.
Would the "parser" module from the third-party dateutil module work for you?
http://pypi.python.org/p
On Fri, Sep 28, 2012 at 12:07 PM, Prasad, Ramit
wrote:
> I guess you can consider re.match's pattern to be
> prefixed with '^'.
You can in this case, but they're not equivalent in multi-line mode:
>>> re.match('^two', 'one\ntwo', re.M)
>>> re.search('^two', 'one\ntwo', re.M)
<_sre.SRE_Match obje
iMath wrote:
> Sent: Wednesday, September 26, 2012 2:39 AM
> To: python-list@python.org
> Subject: regular expression : the dollar sign ($) work with re.match() or
> re.search() ?
>
> I only know the dollar sign ($) will match a pattern from the
> end of a string,but which method does it work wi
Alister writes:
> On Wed, 26 Sep 2012 10:48:00 +0300, Jussi Piitulainen wrote:
>
> > iMath writes:
> >
> >> I only know the dollar sign ($) will match a pattern from the end
> >> of a string, but which method does it work with, re.match() or
> >> re.search()
> >
> > It works with both. With re.m
On Wed, 26 Sep 2012 10:48:00 +0300, Jussi Piitulainen wrote:
> iMath writes:
>
>> I only know the dollar sign ($) will match a pattern from the end of a
>> string, but which method does it work with, re.match() or re.search()
>
> It works with both. With re.match, the pattern has to match at the
iMath wrote:
> I only know the dollar sign ($) will match a pattern from the
> end of a string,but which method does it work with ,re.match() or
> re.search() ?
Why not try it out in the interactive interpreter? Here's the "deluxe
version":
>>> def demo(pattern="mid$", texts=["start mid end",
On Wed, Sep 26, 2012 at 5:48 PM, Jussi Piitulainen
wrote:
> What was the weird character that you used as a question mark? I
> removed them because they confuse the newsreader I use.
It appears to be Unicode Character 'FULLWIDTH QUESTION MARK' (U+FF1F).
Normally I'd be inclined to simply use U+00
iMath writes:
> I only know the dollar sign ($) will match a pattern from the end of
> a string, but which method does it work with, re.match() or
> re.search()
It works with both. With re.match, the pattern has to match at the
start of the string _and_ the $ has to match the end of the string (o
s '(?:a)*)
Also, wouldn't say "very fast". Compare those two groups with 'a*'.
I'm not sure what's going on there.
-- Devin
On Tue, Jan 3, 2012 at 3:07 PM, Octavian Rasnita wrote:
> From: "Devin Jeanpierre"
> Subject: Re: Regul
From: "Devin Jeanpierre"
Subject: Re: Regular expression : non capturing groups are faster ?
>> You meant Perl Documentation, didn't you ?
>
> I guess that works too. I did mean Python, though -- its intent is to
> say "you shouldn't worry about this&q
> You meant Perl Documentation, didn't you ?
I guess that works too. I did mean Python, though -- its intent is to
say "you shouldn't worry about this", but in the process it says "this
does not exist" (a lie).
"slightly better performance" would be accurate, as said by Goyvaerts/
-- Devin
On T
Le 03/01/2012 12:56, Devin Jeanpierre a écrit :
The second assertion sounds more likely. It seems very odd that Python and
Perl implementations are divergent on this point. Any opinion ?
The Python documentation oversimplifies.
You meant Perl Documentation, didn't you ?
It's a commun opinio
1 - 100 of 545 matches
Mail list logo