Re: issue with regular expressions

2019-10-22 Thread joseph pareti
Ok, thanks. It works for me. regards, Am Di., 22. Okt. 2019 um 11:29 Uhr schrieb Matt Wheeler : > > > On Tue, 22 Oct 2019, 09:44 joseph pareti, wrote: > >> the following code ends in an exception: >> >> import re >> pattern = 'Sottoscrizione unica soluzione' >> mylines = []

Re: issue with regular expressions

2019-10-22 Thread Matt Wheeler
On Tue, 22 Oct 2019, 09:44 joseph pareti, wrote: > the following code ends in an exception: > > import re > pattern = 'Sottoscrizione unica soluzione' > mylines = []# Declare an empty list. with open ('tmp.txt', 'rt') as myfile: # Open tmp.txt for reading

issue with regular expressions

2019-10-22 Thread joseph pareti
the following code ends in an exception: import re pattern = 'Sottoscrizione unica soluzione' mylines = []# Declare an empty list. with open ('tmp.txt', 'rt') as myfile: # Open tmp.txt for reading text. for myline in myfile: # For each

Re: Issue with regular expressions

2008-04-30 Thread Gerard Flanagan
On Apr 29, 3:46 pm, Julien [EMAIL PROTECTED] wrote: Hi, I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = ' some words with and without

Re: Issue with regular expressions

2008-04-30 Thread Shawn Milochik
My stab at it: My stab at it: #!/usr/bin/env python import re query = ' some words with and withoutquotes ' query = re.sub(\s+, , query) words = [] while query.__len__(): query = query.strip() print(Current query value: '%s' % query) print words print

Issue with regular expressions

2008-04-29 Thread Julien
Hi, I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = ' some words with and withoutquotes ' p = re.compile(magic_regular_expression)

Re: Issue with regular expressions

2008-04-29 Thread Paul McGuire
On Apr 29, 8:46 am, Julien [EMAIL PROTECTED] wrote: I'd like to select terms in a string, so I can then do a search in my database. query = '    some words  with and without    quotes    ' p = re.compile(magic_regular_expression)   $ --- the magic happens m = p.match(query) I'd like

Re: Issue with regular expressions

2008-04-29 Thread Robert Bossy
Julien wrote: Hi, I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = ' some words with and withoutquotes ' p =

Re: Issue with regular expressions

2008-04-29 Thread cokofreedom
| # Double Quote Text |# match a double quote |(# - Two Possiblities: |\\. # match two backslashes followed by anything (include newline) ||# OR |[^]

Re: Issue with regular expressions

2008-04-29 Thread Paul Melis
Julien wrote: Hi, I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = ' some words with and withoutquotes ' p =

Re: Issue with regular expressions

2008-04-29 Thread Hrvoje Niksic
Julien [EMAIL PROTECTED] writes: I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = ' some words with and withoutquotes ' p =

Re: Issue with regular expressions

2008-04-29 Thread harvey . thomas
On Apr 29, 2:46 pm, Julien [EMAIL PROTECTED] wrote: Hi, I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = '    some words  with and without  

Re: Issue with regular expressions

2008-04-29 Thread Matimus
On Apr 29, 6:46 am, Julien [EMAIL PROTECTED] wrote: Hi, I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = ' some words with and without

Re: Issue with regular expressions

2008-04-29 Thread Paul McGuire
On Apr 29, 9:20 am, Paul McGuire [EMAIL PROTECTED] wrote: On Apr 29, 8:46 am, Julien [EMAIL PROTECTED] wrote: I'd like to select terms in a string, so I can then do a search in my database. query = '    some words  with and without    quotes    ' p =

Re: Issue with regular expressions

2008-04-29 Thread George Sakkis
On Apr 29, 9:46 am, Julien [EMAIL PROTECTED] wrote: Hi, I'm fairly new in Python and I haven't used the regular expressions enough to be able to achieve what I want. I'd like to select terms in a string, so I can then do a search in my database. query = ' some words with and without