James Stroud wrote:
> Paul McGuire wrote:
> > <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Hello,
> >>
> >> I cannot figure out a way to find a regular expression that would
> >>match one and only one of these two strings:
> [clip]
> >>Any suggestion ? Thanks a bunch !
>
Paul McGuire wrote:
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>>Hello,
>>
>> I cannot figure out a way to find a regular expression that would
>>match one and only one of these two strings:
[clip]
>>Any suggestion ? Thanks a bunch !
>>Mathieu
>>
>
> A pyparsing approach i
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I cannot figure out a way to find a regular expression that would
> match one and only one of these two strings:
>
> s1 = ' how are you'
> s2 = 'hello world how are you'
>
> Al
[EMAIL PROTECTED] wrote:
> Hello,
>
> I cannot figure out a way to find a regular expression that would
> match one and only one of these two strings:
>
> s1 = ' how are you'
> s2 = 'hello world how are you'
>
> All I could come up with was:
> patt
[EMAIL PROTECTED] wrote:
> Hello,
>
> I cannot figure out a way to find a regular expression that would
> match one and only one of these two strings:
>
> s1 = ' how are you'
> s2 = 'hello world how are you'
>
> All I could come up with was:
> p
> Which of course does not work. I cannot express the fact: sentence
> have 0 or 1 whitespace, separation of group have two or more
> whitespaces.
>
> Any suggestion ? Thanks a bunch !
How about this:
>>> import re
>>> s = 'hello world how are you'
>>> re.split(r"\s{2,}",s)
[''
Hello,
I cannot figure out a way to find a regular expression that would
match one and only one of these two strings:
s1 = ' how are you'
s2 = 'hello world how are you'
All I could come up with was:
patt = re.compile('^[ ]*([A-Za-z]+)[ ]+([A-Za