nd perhaps doing a little debugging.
-Original Message-
From: Tutor On Behalf Of
Asad
Sent: Thursday, December 27, 2018 10:10 AM
To: tutor@python.org
Subject: [Tutor] Re Module
Hi All ,
I trying find a solution for my script , I have two files :
file1 - I need a search a error s
On Thu, Dec 27, 2018 at 08:40:12PM +0530, Asad wrote:
> Hi All ,
>
> I trying find a solution for my script , I have two files :
>
> file1 - I need a search a error say x if the error matches
>
> Look for the same error x in other file 2
>
> Here is the code :
> I have 10 different pa
On 27/12/2018 15:10, Asad wrote:
> file1 - I need a search a error say x if the error matches
>
> Look for the same error x in other file 2
>
> Here is the code :
> I have 10 different patterns therefore I used list comprehension and
> compiling the pattern so I loop over and find the exact patt
Hi All ,
I trying find a solution for my script , I have two files :
file1 - I need a search a error say x if the error matches
Look for the same error x in other file 2
Here is the code :
I have 10 different patterns therefore I used list comprehension and
compiling the pattern so I
Hey thanks Danny Yoo, Chris “Kwpolska” Warrick, D.V.N Sarma
.
I will take all your inputs.
Thanks a lot.
On Fri, Aug 15, 2014 at 3:32 AM, Danny Yoo wrote:
> On Thu, Aug 14, 2014 at 8:39 AM, D.V.N.Sarma డి.వి.ఎన్.శర్మ
> wrote:
> > I tested it on IDLE. It works.
>
>
> Hi Sarma,
>
>
> Followi
Hi Sunil,
Don't use regular expressions for this task. Use something that knows
about HTML structure. As others have noted, the Beautiful Soup or
lxml libraries are probably a much better choice here.
There are good reasons to avoid regexp for the task you're trying to
do. For example, your re
On Thu, Aug 14, 2014 at 8:39 AM, D.V.N.Sarma డి.వి.ఎన్.శర్మ
wrote:
> I tested it on IDLE. It works.
Hi Sarma,
Following up on this one. I'm pretty sure that:
print re.search("https://docs.python.org/2/howto/regex.html#greedy-versus-non-greedy
for why.
___
-
On Thu, Aug 14, 2014 4:07 PM CEST Chris “Kwpolska” Warrick wrote:
>On 14 Aug 2014 15:58 "Sunil Tech" wrote:
>>
>> Hi,
>>
>> I have string like
>> stmt = 'Patient name: Upadhyay Shyamstyle="font-family: times new roman,times;"> Date of
>birth: 08/08/1988 Issue(s)
I tested it on IDLE. It works.
regards,
Sarma.
On Thu, Aug 14, 2014 at 7:37 PM, Chris “Kwpolska” Warrick <
kwpol...@gmail.com> wrote:
>
> On 14 Aug 2014 15:58 "Sunil Tech" wrote:
> >
> > Hi,
> >
> > I have string like
> > stmt = 'Patient name: Upadhyay Shyam style="font-family: times new roman
On 14 Aug 2014 15:58 "Sunil Tech" wrote:
>
> Hi,
>
> I have string like
> stmt = 'Patient name: Upadhyay Shyam Date of
birth: 08/08/1988 Issue(s) to be
analyzed: tesNurse Clinical summary: test1 Date of
injury: 12/14/2013Diagnoses: 723.4 - 300.02 - 298.3
- 780.50 - 724
Hi,
I have string like
stmt = 'Patient name: Upadhyay Shyam Date of
birth: 08/08/1988 Issue(s) to be
analyzed: tesNurse Clinical summary: test1 Date of
injury: 12/14/2013Diagnoses: 723.4 - 300.02 - 298.3
- 780.50 - 724.4 Brachial neuritis or radiculitis nos - Generaliz
On 04/08/13 08:45, Alex Kleider wrote:
sorry, my bad. I forgot to delete that backslash, I meant
re.findall(r"\be\b", "d e f"). Same with the other example.
..but the interesting thing is that the presence or absence of the
spurious back slashes seems not to change the results.
It wouldn't
Hi,
not quite. The moral is to learn about greedy and non-greedy matching ;)!
-nik
Alex Kleider schrieb:
>On 2013-08-03 13:38, Dominik George wrote:
>> Hi,
>>
>> b is defined as all non-word characters, so it is the complement oft
>> w. w is [A-Za-z0-9_-], so b includes $ and thus cuts off
Hi,
\b is defined as all non-word characters, so it is the complement oft \w. \w is
[A-Za-z0-9_-], so \b includes \$ and thus cuts off your group.
-nik
Alex Kleider schrieb:
>#!/usr/bin/env python
>
>"""
>I've been puzzling over the re module and have a couple of questions
>regarding the be
: Mon, 9 Jan 2012 14:47:46
To:
Subject: [Tutor] re module help
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
___
Tutor
Hi Gurus,
I have created regular expression with os modules, I have created file
sdptool to match the regular expression pattern, will print the result.
I want without creating file how to get required output, I tried but i
didn't get output correctly, over stream.
#! /usr/bin/python
import os,re
By the way with your helper function algorithm Steven and Peter comments
you made me think of this change:
karim@Requiem4Dream:~$ echo 'prima " "' | sed -e
's/""/\\"\\"/g;s/\([^\]\)"/\1\\"/g'
prima \" \"
karim@Requiem4Dream:~$ echo 'prima ""' | sed -e
's/""/\\"\\"/g;s/\([^\]\)"/\1\\"/g'
pr
On 02/04/2011 11:26 AM, Peter Otten wrote:
Karim wrote:
That is not the thing I want. I want to escape any " which are not
already escaped.
The sed regex '/\([^\\]\)\?"/\1\\"/g' is exactly what I need (I have
made regex on unix since 15 years).
Can the backslash be escaped, too? If so I don't
On 02/04/2011 02:36 AM, Steven D'Aprano wrote:
Karim wrote:
*Indeed what's the matter with RE module!?*
You should really fix the problem with your email program first;
Thunderbird issue with bold type (appears as stars) but I don't know
how to fix it yet.
A man when to a doctor and said, "
Karim wrote:
> That is not the thing I want. I want to escape any " which are not
> already escaped.
> The sed regex '/\([^\\]\)\?"/\1\\"/g' is exactly what I need (I have
> made regex on unix since 15 years).
Can the backslash be escaped, too? If so I don't think your regex does what
you think
Karim wrote:
> Recall:
>
> >>> re.subn(r'([^\\])?"', r'\1\\"', expression)
>
> Traceback (most recent call last):
> File "", line 1, in
> File "/home/karim/build/python/install/lib/python2.7/re.py", line
> 162, in subn
>return _compile(pattern, flags).subn(repl, string, count)
Karim wrote:
*Indeed what's the matter with RE module!?*
You should really fix the problem with your email program first;
Thunderbird issue with bold type (appears as stars) but I don't know how
to fix it yet.
A man when to a doctor and said, "Doctor, every time I do this, it
hurts. What sh
"Karim" wrote
Because expression = *' "" '* is in fact fact expression = ' "" '.
The bold appear as stars I don't know why.
Because in the days when email was always sent in plain
ASCII text the way to show "bold" was to put asterisks around
it. Underlining used _underscores_ like so...
On 02/03/2011 07:47 PM, Karim wrote:
On 02/03/2011 02:15 PM, Peter Otten wrote:
Karim wrote:
I am trying to subsitute a '""' pattern in '\"\"' namely escape 2
consecutives double quotes:
* *In Python interpreter:*
$ python
Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40)
[GCC 4.4.
On 02/03/2011 11:20 PM, Dave Angel wrote:
On 01/-10/-28163 02:59 PM, Karim wrote:
On 02/03/2011 02:15 PM, Peter Otten wrote:
Karim wrote:
(snip>
*Indeed what's the matter with RE module!?*
You should really fix the problem with your email program first;
Thunderbird issue with bold type (ap
On 01/-10/-28163 02:59 PM, Karim wrote:
On 02/03/2011 02:15 PM, Peter Otten wrote:
Karim wrote:
(snip>
*Indeed what's the matter with RE module!?*
You should really fix the problem with your email program first;
Thunderbird issue with bold type (appears as stars) but I don't know how
to fix
On 02/03/2011 02:15 PM, Peter Otten wrote:
Karim wrote:
I am trying to subsitute a '""' pattern in '\"\"' namely escape 2
consecutives double quotes:
* *In Python interpreter:*
$ python
Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40)
[GCC 4.4.3] on linux2
Type "help", "copyright",
Karim wrote:
> I am trying to subsitute a '""' pattern in '\"\"' namely escape 2
> consecutives double quotes:
>
> * *In Python interpreter:*
>
> $ python
> Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for m
I forget something. There is no issue with python and double quotes.
But I need to give it to TCL script but as TCL is shit string is only
delimited by double quotes.
Thus I need to escape it to not have syntax error whith nested double
quotes.
Regards
The poor tradesman
On 02/03/2011 12:45
Hello Steven,
I am perhaps a poor tradesman but I have to blame my thunderbird tool :-P .
Because expression = *' "" '* is in fact fact expression = ' "" '.
The bold appear as stars I don't know why. I need to have escapes for
passing it to another language (TCL interpreter).
So I will rewrit
Karim wrote:
Hello,
I am trying to subsitute a '""' pattern in '\"\"' namely escape 2
consecutives double quotes:
You don't have to escape quotes. Just use the other sort of quote:
>>> print '""'
""
* *In Python interpreter:*
$ python
Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:5
Hello,
Any news on this topic?O:-)
Regards
Karim
On 02/02/2011 08:21 PM, Karim wrote:
Hello,
I am trying to subsitute a '""' pattern in '\"\"' namely escape 2
consecutives double quotes:
* *In Python interpreter:*
$ python
Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40)
[GCC
Hello,
I am trying to subsitute a '""' pattern in '\"\"' namely escape 2
consecutives double quotes:
* *In Python interpreter:*
$ python
Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Thanks Kent! Once more you go straight to the point!
Kent Johnson writes:
> On Wed, Jun 24, 2009 at 2:24 PM, Tiago Saboga wrote:
>> In [33]: re.search("(a[^.]*?b\.\s?){2}", text).group(0)
>> Out[33]: 'a45453b. a325643b. '
>
> group(0) is the entire match so this returns what you expect. But what
Ok -- realized my "solution" incorrectly strips white space from
multiword strings:
> Out[92]: ['a2345b.', 'a45453b.a325643b.a435643b.']
>
So here are some more gymnastics to get the correct result:
In [105]: newlist
Out[105]: ['a2345b.', '|', 'a45453b.', 'a325643b.', 'a435643b.', '|']
In [109]
As usual, Kent Johnson has swooped in an untangled the mess with a
clear explanation.
By the time a regex gets this complicated, I typically start thinking
of ways to simplify or avoid them altogether.
Below is the code I came up with. It goes through some gymnastics and
can surely stand improvem
On Wed, Jun 24, 2009 at 2:24 PM, Tiago Saboga wrote:
> Hi!
>
> I am trying to split some lists out of a single text file, and I am
> having a hard time. I have reduced the problem to the following one:
>
> text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b."
>
> Of this line of text, I wan
Serdar Tumgoren writes:
> Hey Tiago,
>
>> text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b."
>>
>> Of this line of text, I want to take out strings where all words start
>> with a, end with "b.". But I don't want a list of words. I want that:
>>
>> ["a2345b.", "a45453b. a325643b. a4356
apologies -- I just reread your post and appears you also want to
capture the dot after each "b" ( "b." )
In that case, you need to update the pattern to match for the dot. But
because the dot is itself a metacharacter, you have to escape it with
a backslash:
In [23]: re.findall(r'a\w+b\.',text)
Hey Tiago,
> text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b."
>
> Of this line of text, I want to take out strings where all words start
> with a, end with "b.". But I don't want a list of words. I want that:
>
> ["a2345b.", "a45453b. a325643b. a435643b."]
>
Are you saying you want a
Hi!
I am trying to split some lists out of a single text file, and I am
having a hard time. I have reduced the problem to the following one:
text = "a2345b. f325. a45453b. a325643b. a435643b. g234324b."
Of this line of text, I want to take out strings where all words start
with a, end with "b.".
Joseph Quigley wrote on Fri, 01 Apr 2005 10:07:08 -0600:
> I have some code on a geek dictionary that I'm making where the command
> geeker() opens a module for the "real" geek dictionary (where you can type
> a word to see what it is geekified). Supposedly, you type lobby() to go
> back to w
42 matches
Mail list logo