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
On
Behalf Of jose isaias cabrera
Sent: Thursday, March 2, 2023 2:23 PM
To: python-list@python.org
Subject: Regular Expression bug?
Greetings.
For the RegExp Gurus, consider the following python3 code:
import re
s = "pn=align upgrade sd=2023-02-"
ro = re.compile(r"pn=(.+) &
n 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 'align' because the group only goes up-to
> > the space. Thought
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
)
> align upgrade
>
>
> This is wrong. It should be 'align' because the group only goes up-to
> the space. Thoughts? Thanks.
The bug is in your regular expression; the plus modifier is greedy.
If you want to match up to the first space, then you'll need somethin
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
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. It should be 'align' because the group only goes up-to
the space. Thoughts? Thanks.
Am Montag, 14. Oktober 2019 13:56:09 UTC+2 schrieb Chris Angelico:
>
> (My apologies for saying this in reply to an unrelated post, but I
> also don't see those posts, so it's not easy to reply to them.)
>
> ChrisA
Nothing to apologize and thank you for clarification,
I was already checking my s
On Mon, Oct 14, 2019 at 10:41 PM Eko palypse wrote:
>
> Am Sonntag, 13. Oktober 2019 21:20:26 UTC+2 schrieb moi:
> > [Do not know why I spent hours with this...]
> >
> > To answer you question.
> > Yes, I confirm.
> > It seems that as soon as one works with bytes and when
> > a char is encoded in
Am Sonntag, 13. Oktober 2019 21:20:26 UTC+2 schrieb moi:
> [Do not know why I spent hours with this...]
>
> To answer you question.
> Yes, I confirm.
> It seems that as soon as one works with bytes and when
> a char is encoded in more than 1 byte, "re" goes into
> troubles.
>
First, sorry for a
the current buffer to me.
The problem is that the buffer can have all possible encodings.
cp1251, cp1252, utf8, ucs-2 ... but scintilla informs me about
which encoding is currently used.
I wanted to realize a regular expression tester with Python3,
and mark the text that has been matched by regular
re.LOCALE are slow. It may be more efficient to
decode text and use Unicode regular expression.
Thank you, I guess I'm convinced to always decode everything (re pattern and
text) to utf8 internally and then do the re search but then I would need to
figure out the correct position, hmm -
On Sun, Oct 13, 2019 at 7:16 AM Richard Damon wrote:
>
> On 10/12/19 3:46 PM, Eko palypse wrote:
> > Thank you very much for your answer.
> >
> >> You have to be able to match bytes, not strings.
> > May I ask you to elaborate on this, sorry non-native English speaker.
> > The buffer I receive is
charsets. So even if you set the utf-8 locale, it
would not help.
Regular expressions with re.LOCALE are slow. It may be more efficient to
decode text and use Unicode regular expression.
+1
It's best to treat re.LOCALE as being for old legacy encodings that
use/used 8 bits per character. Whe
On 10/12/19 3:46 PM, Eko palypse wrote:
> Thank you very much for your answer.
>
>> You have to be able to match bytes, not strings.
> May I ask you to elaborate on this, sorry non-native English speaker.
> The buffer I receive is a byte-like buffer.
>
>> I don't think you'll be able to 100% reliab
hen you're matching text (the normal way you use a regular
expression), every element in the RE matches a character (or
emptiness). For instance, the regular expression "^[bc]at$" has these
elements:
"^" matches emptiness at the start
"[bc]" matches either "
ow. It may be more efficient to
> decode text and use Unicode regular expression.
Thank you, I guess I'm convinced to always decode everything (re pattern and
text) to utf8 internally and then do the re search but then I would need to
figure out the correct position, hmm - some ongoi
Thank you very much for your answer.
> You have to be able to match bytes, not strings.
May I ask you to elaborate on this, sorry non-native English speaker.
The buffer I receive is a byte-like buffer.
> I don't think you'll be able to 100% reliably match bytes in this way.
> You're asking it to
would not help.
Regular expressions with re.LOCALE are slow. It may be more efficient to
decode text and use Unicode regular expression.
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Oct 13, 2019 at 5:11 AM Eko palypse wrote:
>
> What needs to be set in order to be able to use a re search within
> utf8 encoded bytes?
You have to be able to match bytes, not strings.
> So how can I make it work with utf8 encoded text?
> Note, decoding it to a string isn't preferred as
What needs to be set in order to be able to use a re search within
utf8 encoded bytes?
My test, being on a windows PC with cp1252 setup, looks like this
import re
import locale
cp1252 = 'Ärger im Paradies'.encode('cp1252')
utf8 = 'Ärger im Paradies'.encode('utf-8')
print('cp1252:', cp1252)
pr
.7/library/re.html#regular-expression-objects
nor with help
import re
lex = re.compile("foo")
help(lex.scanner)
Help on built-in function scanner:
scanner(string, pos=0, endpos=2147483647) method of _sre.SRE_Pattern
instance
Does anybody know where to find a doc ?
--
https://mail.python.
Hi,
I'd like to use a program to convert between basic regular expression
(BRE) and extended regular expression (ERE). (see man grep for the
definition of BRE and ERE). Does python has a module for this purpose?
Thanks.
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
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
be either a length or a "from-until"
>
> - a length will be a positive integer (no bounds checking)
>
> - "from-until" is: a positive integer, a '-', and a positive integer (no sanity checking)
>
> - options needs to be able to contain nearly anythi
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
ain '$' '<' '>' ':'
> >
> > - range can be either a length or a "from-until"
> >
> > - a length will be a positive integer (no bounds checking)
> >
> > - "from-until" is: a positive integer, a '
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 '(:?[^:]+)*' (F
<...$<...>$...>>>$
(lower=earlier parsing passes will be inside)
- the internal structure is "name::options::range"
$$
- name will *not* contain '$' '<' '>' ':'
- range can be either a leng
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
>$
- placeholders for different parsing passes must be nestable:
$<<<...$<...>$...>>>$
(lower=earlier parsing passes will be inside)
- the internal structure is "name::options::range"
$$
- name will *not* contain
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:
>
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 = '\$<[^<:]
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*?>\$|\$<[^<:]+?::.*?::\d+-\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
> 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.
> >
> > C
?
What have you tried?
Why do you need regular expression?
>>> s = 'first-324-True-rms-kjhg-Meterc639.html'
>>> s[-4:]
'html'
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
--
https://mail.python.org/mailman/listinfo/python-list
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.?
Regards,
Kunal
--
https://mail.python.org/mailman/listinfo/python-list
ith('firefox') for i in process_iter()):
>
> Or use a regex match if the condition becomes more complex. Even then,
> there is re.match to attemp a match at the start of the string, which
> helps to keep the expression simple.
If regular expression objects were to support eq
On Friday 26 May 2017 14:25 CEST, Jussi Piitulainen wrote:
> Rustom Mody writes:
>
>> On Friday, May 26, 2017 at 5:02:55 PM UTC+5:30, Cecil Westerhof wrote:
>>> To check if Firefox is running I use:
>>> if not 'firefox' in [i.name() for i in list(process_iter())]:
>>>
>>> It probably could be mad
On Friday, May 26, 2017 at 5:55:32 PM UTC+5:30, Jussi Piitulainen wrote:
> Rustom Mody writes:
>
> > On Friday, May 26, 2017 at 5:02:55 PM UTC+5:30, Cecil Westerhof wrote:
> >> To check if Firefox is running I use:
> >> if not 'firefox' in [i.name() for i in list(process_iter())]:
> >>
> >> I
Jussi Piitulainen writes:
> Or use a regex match if the condition becomes more complex. Even then,
> there is re.match to attemp a match at the start of the string, which
> helps to keep the expression simple.
Soz: attemp' a match.
--
https://mail.python.org/mailman/listinfo/python-list
Rustom Mody writes:
> On Friday, May 26, 2017 at 5:02:55 PM UTC+5:30, Cecil Westerhof wrote:
>> To check if Firefox is running I use:
>> if not 'firefox' in [i.name() for i in list(process_iter())]:
>>
>> It probably could be made more efficient, because it can stop when it
>> finds the firs
On 2017-05-26 13:29, Cecil Westerhof wrote:
> To check if Firefox is running I use:
> if not 'firefox' in [i.name() for i in list(process_iter())]:
>
> It probably could be made more efficient, because it can stop when
> it finds the first instance.
>
> But know I switched to Debian and there
On Friday, May 26, 2017 at 5:02:55 PM UTC+5:30, Cecil Westerhof wrote:
> To check if Firefox is running I use:
> if not 'firefox' in [i.name() for i in list(process_iter())]:
>
> It probably could be made more efficient, because it can stop when it
> finds the first instance.
>
> But know I s
To check if Firefox is running I use:
if not 'firefox' in [i.name() for i in list(process_iter())]:
It probably could be made more efficient, because it can stop when it
finds the first instance.
But know I switched to Debian and there firefox is called firefox-esr.
So I should use:
re.se
elds have a double quoted
> string as part of it (and that double quoted string can have commas).
> Above string have only 6 fields. First is a, second is b and last is
> f "5546,3434,345,34,34,5,34,543,7".
> How can I split this string in its fields using regula
part of it (and that double quoted string can have
> commas). Above string have only 6 fields. First is a, second is
> b and last is f "5546,3434,345,34,34,5,34,543,7". How can I
> split this string in its fields using regular expression ? or even
> if there is any ot
ields have a double
> quoted string as part of it (and that double quoted string can have
> commas). Above string have only 6 fields. First is a, second is
> b and last is f "5546,3434,345,34,34,5,34,543,7". How can I
> split this string in its fields using regul
t some of the fields have a double quoted
> string as part of it (and that double quoted string can have commas).
> Above string have only 6 fields. First is a, second is b and last is
> f "5546,3434,345,34,34,5,34,543,7".
> How can I split this string in its field
quoted string can have commas).
Above string have only 6 fields. First is a, second is b and last is
f "5546,3434,345,34,34,5,34,543,7".
How can I split this string in its fields using regular expression ? or even if
there is any other way to do this, please speak out.
Thank
Since ‘n*’ matches zero or more ‘n’s, it matches zero adjacent to every
actual character.
It's non-greedy because it matches as few characters as will allow the
match to succeed.
> I think the repl argument should replaces every char in text and
> outputs "".
I hope that h
Look this
>>> import re
>>> text="asdfnbd]"
>>> m=re.sub("n*?","?",text)
>>> print m
?a?s?d?f?n?b?d?]?
I don't understand the 'non-greedy' pattern.
I think the repl argument should replaces every char in text and outputs
"".
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 30 Sep 2015 23:30:47 +, Denis McMahon wrote:
> On Wed, 30 Sep 2015 11:34:04 -0700, massi_srb wrote:
>
>> firstly the description of my problem. I have a string in the following
>> form: .
>
> The way I solved this was to:
>
> 1) replace all the punctuation in the string with spa
On Oct 2, 2015 12:35 AM, "Denis McMahon" wrote:
>
> On Thu, 01 Oct 2015 01:48:03 -0700, gal kauffman wrote:
>
> > items = s.replace(' (', '(').replace(', ',',').split()
> >
> > items_dict = dict()
> > for item in items:
> > if '(' not in item:
> > item += '(0,0)'
> > if ',' not in
On Thu, 01 Oct 2015 15:53:38 +, Rob Gaddi wrote:
> There's a quote for this. 'Some people, when confronted with a problem,
> think “I know, I'll use regular expressions.” Now they have two
> problems.'
I actually used 2 regexes:
wordpatt = re.compile('[a-zA-Z]+')
numpatt = re.compile('[0-
On Thu, 01 Oct 2015 01:48:03 -0700, gal kauffman wrote:
> items = s.replace(' (', '(').replace(', ',',').split()
>
> items_dict = dict()
> for item in items:
> if '(' not in item:
> item += '(0,0)'
> if ',' not in item:
> item = item.replace(')', ',0)')
>
> name, raw_
On Wed, 30 Sep 2015 11:34:04 -0700, massi_srb wrote:
> Hi everyone,
>
> firstly the description of my problem. I have a string in the following
> form:
>
> s = "name1 name2(1) name3 name4 (1, 4) name5(2) ..."
>
> that is a string made up of groups in the form 'name' (letters only)
> plus possib
My example will give false positive if there is a space before a comma. Or
anything else by the conventions in the original string.
I tried to keep it as simple as I could.
If you want to catch a wider range of values you can use *simple* regular
expression to catch as much spaces as you want.
On
On 2015-10-01 01:48, gal kauffman wrote:
> items = s.replace(' (', '(').replace(', ',',').split()
s = "name1 (1)"
Your suggestion doesn't catch cases where more than one space can
occur before the paren.
-tkc
--
https://mail.python.org/mailman/listinfo/python-list
items = s.replace(' (', '(').replace(', ',',').split()
items_dict = dict()
for item in items:
if '(' not in item:
item += '(0,0)'
if ',' not in item:
item = item.replace(')', ',0)')
name, raw_data = item.split('(')
data_tuple = tuple((int(v) for v in
raw_data.repla
On 9/30/2015 12:20 PM, Tim Chase wrote:
On 2015-09-30 11:34, massi_...@msn.com wrote:
I guess this problem can be tackled with regular expressions, b
... However, if you *want* to do it with
regular expressions, you can. It's ugly and might be fragile, but
##
On Wed, 30 Sep 2015 11:34:04 -0700, massi_srb wrote:
> firstly the description of my problem. I have a string in the following
> form: .
The way I solved this was to:
1) replace all the punctuation in the string with spaces
2) split the string on space
3) process each thing in the list to
On 2015-09-30 11:34, massi_...@msn.com wrote:
> firstly the description of my problem. I have a string in the
> following form:
>
> s = "name1 name2(1) name3 name4 (1, 4) name5(2) ..."
>
> that is a string made up of groups in the form 'name' (letters
> only) plus possibly a tuple containing 1 or
On Wed, Sep 30, 2015 at 2:50 PM, Emile van Sebille wrote:
> On 9/30/2015 11:34 AM, massi_...@msn.com wrote:
>
>> Hi everyone,
>>
>> firstly the description of my problem. I have a string in the following
>> form:
>>
>> s = "name1 name2(1) name3 name4 (1, 4) name5(2) ..."
>>
>> that is a string ma
On 9/30/2015 11:34 AM, massi_...@msn.com wrote:
Hi everyone,
firstly the description of my problem. I have a string in the following form:
s = "name1 name2(1) name3 name4 (1, 4) name5(2) ..."
that is a string made up of groups in the form 'name' (letters only) plus
possibly a tuple containing
Hi everyone,
firstly the description of my problem. I have a string in the following form:
s = "name1 name2(1) name3 name4 (1, 4) name5(2) ..."
that is a string made up of groups in the form 'name' (letters only) plus
possibly a tuple containing 1 or 2 integer values. Blanks can be placed betwe
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
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
have an unexpected duplication of the repl
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
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 sting is "__string1_string2" and the output
is "_string1_string2
On 2015-05-19 06:42, massi_...@msn.com wrote:
> I succesfully wrote a regex in python in order to substitute all
> the occurences in the form $"somechars" with another string. Here
> it is:
>
> re.sub(ur"""(?u)(\$\"[^\"\\]*(?:\\.[^\"\\]*)*\")""", newstring,
> string)
The expression is a little mo
Hi everyone,
I succesfully wrote a regex in python in order to substitute all the occurences
in the form $"somechars" with another string. Here it is:
re.sub(ur"""(?u)(\$\"[^\"\\]*(?:\\.[^\"\\]*)*\")""", newstring, string)
Now I would need to exclude from the match all the string in the form $"
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.
> [...]
> >> Al
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
means
> >> what
> >> you think.
> >>
> >> You're getting None because the regexp fails to match.
> >>
> >> >> Try printing each string you're trying to match using 'repr', i.e.:
> >> >> print(r
ok like they should match?
> print(repr(content[j])) gives me the following:
>
>[None]
>'#D{#C[Health] #P[Information] - \n'
[...]
>shouldn't it match "#C[Health]" in the first row?
It looks like it should, unless you have mangled your regular expression. You
ment
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
print(repr(content[j]))
> >>
> >> Do any look like they should match?
> > print(repr(content[j])) gives me the following:
> >
> >[None]
> >'#D{#C[Health] #P[Information] - \n'
> [...]
> >shouldn't it match "#C[H
1 - 100 of 1465 matches
Mail list logo