Sorry, if I missed some further specification in the earlier thread or
if the following is oversimplification of the original problem (using
3 numbers instead of 32),
would something like the following work for your data?
>>> import re
>>> data = """2.201000e+01 2.15e+01 2.199000e+01 : (instan
On Friday, August 19, 2011, Carl Banks wrote:
> On Friday, August 19, 2011 10:33:49 AM UTC-7, Matt Funk wrote:
> > number = r"\d\.\d+e\+\d+"
> > numbersequence = r"%s( %s){31}(.+)" % (number,number)
> > instance_linetype_pattern = re.compile(numbersequence)
> >
> > The results obtained are:
> > re
On Friday, August 19, 2011, jmfauth wrote:
> On 19 août, 19:33, Matt Funk wrote:
> > The results obtained are:
> > results:
> > [(' 2.199000e+01', ' : (instance: 0)\t:\tsome description')]
> > so this matches the last number plus the string at the end of the line,
> > but no retaining the previous
On 19/08/2011 20:55, ru...@yahoo.com wrote:
On 08/19/2011 11:33 AM, Matt Funk wrote:
On Friday, August 19, 2011, Alain Ketterlin wrote:
Matt Funk writes:
thanks for the suggestion. I guess i had found another way around the
problem as well. But i really wanted to match the line exactly and i
On Friday, August 19, 2011 10:33:49 AM UTC-7, Matt Funk wrote:
> number = r"\d\.\d+e\+\d+"
> numbersequence = r"%s( %s){31}(.+)" % (number,number)
> instance_linetype_pattern = re.compile(numbersequence)
>
> The results obtained are:
> results:
> [(' 2.199000e+01', ' : (instance: 0)\t:\tsome desc
On 08/19/2011 11:33 AM, Matt Funk wrote:
> On Friday, August 19, 2011, Alain Ketterlin wrote:
>> Matt Funk writes:
>> > thanks for the suggestion. I guess i had found another way around the
>> > problem as well. But i really wanted to match the line exactly and i
>> > wanted to know why it doesn't
On 19 août, 19:33, Matt Funk wrote:
>
> The results obtained are:
> results:
> [(' 2.199000e+01', ' : (instance: 0)\t:\tsome description')]
> so this matches the last number plus the string at the end of the line, but no
> retaining the previous numbers.
>
> Anyway, i think at this point i will go
On Friday, August 19, 2011, Alain Ketterlin wrote:
> Matt Funk writes:
> > thanks for the suggestion. I guess i had found another way around the
> > problem as well. But i really wanted to match the line exactly and i
> > wanted to know why it doesn't work. That is less for the purpose of
> > gett
Matt Funk writes:
> thanks for the suggestion. I guess i had found another way around the
> problem as well. But i really wanted to match the line exactly and i
> wanted to know why it doesn't work. That is less for the purpose of
> getting the thing to work but more because it greatly annoys me
On 19 août, 17:20, Matt Funk wrote:
> Hi,
> thanks for the suggestion. I guess i had found another way around the
> problem as well. But i really wanted to match the line exactly and i
> wanted to know why it doesn't work. That is less for the purpose of
> getting the thing to work but more becaus
Hi,
thanks for the suggestion. I guess i had found another way around the
problem as well. But i really wanted to match the line exactly and i
wanted to know why it doesn't work. That is less for the purpose of
getting the thing to work but more because it greatly annoys me off that
i can't figure
> Hi Josh,
> thanks for the reply. I am no expert so please bear with me:
> I thought that the {32} was supposed to match the previous expression 32
> times?
>
> So how can i have all matches accessible to me?
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "he
Hi Josh,
thanks for the reply. I am no expert so please bear with me:
I thought that the {32} was supposed to match the previous expression 32
times?
So how can i have all matches accessible to me?
matt
On Thursday, August 18, 2011, Josh Benner wrote:
> On Thu, Aug 18, 2011 at 4:03 PM, Matt F
On Thu, Aug 18, 2011 at 4:03 PM, Matt Funk wrote:
> Hi guys,
>
> thanks for the suggestions. I had tried the white space before as well (to
> no
> avail). So here is the expression i am using (based on suggestions), but
> still
> no success:
>
> instance_linetype_pattern_str =\
>r'(([-+]?
Hi guys,
thanks for the suggestions. I had tried the white space before as well (to no
avail). So here is the expression i am using (based on suggestions), but still
no success:
instance_linetype_pattern_str =\
r'(([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+))?\s+){32}(.+)'
instance_linetype_
2011/8/18 Matt Funk :
> Hi,
> i am sorry if this doesn't quite match the subject of the list. If someone
> takes offense please point me to where this question should go. Anyway, i have
> a problem using regular expressions. I would like to match the line:
>
> 1.002000e+01 2.037000e+01 2.128000e+01
In Matt Funk
writes:
> 1.002000e+01 2.037000e+01 2.128000e+01 1.908000e+01 1.871000e+01 1.914000e+01
> instance_linetype_pattern_str = '([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)
> {32}'
> instance_linetype_pattern = re.compile(instance_linetype_pattern_str)
Does your regexp account for the s
You don't seem to account for the whitespace between the floats. Try
> '([-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?\s+){32}'
(just added \s+).
Martin
On 8/18/2011 9:49 PM, Matt Funk wrote:
> Hi,
> i am sorry if this doesn't quite match the subject of the list. If someone
> takes offense please poin
Hi,
i am sorry if this doesn't quite match the subject of the list. If someone
takes offense please point me to where this question should go. Anyway, i have
a problem using regular expressions. I would like to match the line:
1.002000e+01 2.037000e+01 2.128000e+01 1.908000e+01 1.871000e+01 1.91
19 matches
Mail list logo