On Nov 25, 8:40 am, Jean-Michel Pichavant
wrote:
> Hy guys,
>
> I'm struggling matching patterns ending with a comma ',' or an end of
> line '$'.
>
> import re
>
> ex1 = 'sumthin,'
> ex2 = 'sumthin'
> m1 = re.match('(?P\S+),', ex1)
> m2 = re.match('(?P\S+)$', ex2)
> m3 = re.match('(?P\S+)[,$]', ex
On 25/11/2010 16:26, Jean-Michel Pichavant wrote:
MRAB wrote:
On 25/11/2010 14:40, Jean-Michel Pichavant wrote:
Hy guys,
I'm struggling matching patterns ending with a comma ',' or an end of
line '$'.
import re
ex1 = 'sumthin,'
ex2 = 'sumthin'
m1 = re.match('(?P\S+),', ex1)
m2 = re.match('(?
MRAB wrote:
On 25/11/2010 14:40, Jean-Michel Pichavant wrote:
Hy guys,
I'm struggling matching patterns ending with a comma ',' or an end of
line '$'.
import re
ex1 = 'sumthin,'
ex2 = 'sumthin'
m1 = re.match('(?P\S+),', ex1)
m2 = re.match('(?P\S+)$', ex2)
m3 = re.match('(?P\S+)[,$]', ex1)
m4
On 25/11/2010 14:40, Jean-Michel Pichavant wrote:
Hy guys,
I'm struggling matching patterns ending with a comma ',' or an end of
line '$'.
import re
ex1 = 'sumthin,'
ex2 = 'sumthin'
m1 = re.match('(?P\S+),', ex1)
m2 = re.match('(?P\S+)$', ex2)
m3 = re.match('(?P\S+)[,$]', ex1)
m4 = re.match('(
Try this: '(?P\S+)(,|$)'
On Thu, Nov 25, 2010 at 9:40 AM, Jean-Michel Pichavant <
jeanmic...@sequans.com> wrote:
> Hy guys,
>
> I'm struggling matching patterns ending with a comma ',' or an end of line
> '$'.
>
> import re
>
> ex1 = 'sumthin,'
> ex2 = 'sumthin'
> m1 = re.match('(?P\S+),', ex1)
>
Hy guys,
I'm struggling matching patterns ending with a comma ',' or an end of
line '$'.
import re
ex1 = 'sumthin,'
ex2 = 'sumthin'
m1 = re.match('(?P\S+),', ex1)
m2 = re.match('(?P\S+)$', ex2)
m3 = re.match('(?P\S+)[,$]', ex1)
m4 = re.match('(?P\S+)[,$]', ex2)
print m1, m2
print m3
print m4