On 2012-12-08 23:34, Hans Mulder wrote:
On 8/12/12 23:57:48, rh wrote:
Not sure if the \w sequence includes the - or the . or the /
I think it does not.
You guessed right:
[ c for c in 'x-./y' if re.match(r'\w', c) ]
['x', 'y']
So x and y match \w and -, . and / do not.
This is short
On 2012-12-08 23:27, Hans Mulder wrote:
On 8/12/12 23:19:40, rh wrote:
I reduced the expression too. Now I wonder why re.DEBUG doesn't unroll
category_word. Some other re flag?
he category word consists of the '_' character and the
characters for which .isalnum() return True.
On my system the
On 8/12/12 23:57:48, rh wrote:
> Not sure if the \w sequence includes the - or the . or the /
> I think it does not.
You guessed right:
>>> [ c for c in 'x-./y' if re.match(r'\w', c) ]
['x', 'y']
>>>
So x and y match \w and -, . and / do not.
Hope this helps,
-- HansM
--
http://mail.python
On 8/12/12 23:19:40, rh wrote:
> I reduced the expression too. Now I wonder why re.DEBUG doesn't unroll
> category_word. Some other re flag?
he category word consists of the '_' character and the
characters for which .isalnum() return True.
On my system there are 102158 characters matching '\w':
On 8/12/12 18:48:13, rh wrote:
> Look through some code I found this and wondered about what it does:
> ^(?P[0-9A-Za-z-_.//]+)$
>
> Here's my walk through:
>
> 1) ^ match at start of string
> 2) ?P if a match is found it will be accessible in a
> variable salsipuedes
I wouldn't call it a variab
On 2012-12-08 17:48, rh wrote:
Look through some code I found this and wondered about what it does:
^(?P[0-9A-Za-z-_.//]+)$
Here's my walk through:
1) ^ match at start of string
2) ?P if a match is found it will be accessible in a variable
salsipuedes
3) [0-9A-Za-z-_.//] this is the one that