This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年03月09日 06:11 by py.user, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg155208 - (view) | Author: py.user (py.user) * | Date: 2012年03月09日 06:11 | |
>>> import re >>> re.search(r'\Ac\Z', 'c') <_sre.SRE_Match object at 0xb74cff38> >>> re.search(r'[\A]c[\Z]', 'c') >>> re.purge() >>> re.search(r'[\A]c[\Z]', 'c', re.DEBUG) in at at_beginning_string literal 99 in at at_end_string >>> |
|||
| msg155210 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2012年03月09日 07:37 | |
What behavior would you expect? |
|||
| msg155253 - (view) | Author: Matthew Barnett (mrabarnett) * (Python triager) | Date: 2012年03月09日 18:10 | |
Within a character set \A and \Z should behave like, say, \C; in other words, they should be the literals "A" and "Z". |
|||
| msg155273 - (view) | Author: py.user (py.user) * | Date: 2012年03月10日 00:19 | |
Martin v. Löwis wrote: > What behavior would you expect? I expected similar work >>> re.search(r'[\s]a', ' a').group() ' a' >>> re.search(r'[\s]a', 'ba').group() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'group' >>> >>> >>> re.search(r'[^\s]a', ' a').group() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'group' >>> re.search(r'[^\s]a', 'ba').group() 'ba' >>> |
|||
| msg155276 - (view) | Author: Matthew Barnett (mrabarnett) * (Python triager) | Date: 2012年03月10日 01:09 | |
\s matches a character, whereas \A and \Z don't. Within a character set \s makes sense, but \A and \Z don't, so they should be treated as literals. |
|||
| msg155294 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2012年03月10日 06:55 | |
Duplicate of #13899. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:27 | admin | set | github: 58445 |
| 2012年03月10日 07:17:32 | georg.brandl | set | status: open -> closed resolution: duplicate |
| 2012年03月10日 06:55:20 | georg.brandl | set | superseder: re pattern r"[\A]" should work like "A" but matches nothing. Ditto B and Z. messages: + msg155294 nosy: + georg.brandl |
| 2012年03月10日 01:09:36 | mrabarnett | set | messages: + msg155276 |
| 2012年03月10日 00:19:07 | py.user | set | messages: + msg155273 |
| 2012年03月09日 18:10:43 | mrabarnett | set | messages: + msg155253 |
| 2012年03月09日 07:37:51 | loewis | set | nosy:
+ loewis messages: + msg155210 |
| 2012年03月09日 06:11:13 | py.user | create | |