473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

python regex: misbehaviour with "\r" (0x0D) as Newline characterin Unicode Mode

Hi,

concerning to unicode, "\n", "\r "and "\r\n" (0x000A, 0x000D and
0x000D+0x000A) should be threatened as newline character
at least this is how i understand it:
(http://en.wikipedia.org/wiki/Newline#Unicode)

obviously, the re module does not care, and on unix, only threatens \n
as newline char:
>>a=re.compile(u"^a",re.U|re.M)
a.search(u"bc\ra")
a.search(u"bc\na")
<_sre.SRE_Match object at 0xb5908fa8>

same thing for $:
>>b = re.compile(u"c$",re.U|re.M)
b.search(u"bc\r\n")
b.search(u"abc")
<_sre.SRE_Match object at 0xb5908f70>
>>b.search(u"bc\nde")
<_sre.SRE_Match object at 0xb5908fa8>

is this a known bug in the re module? i couldn't find any issues in the
bug tracker.
Or is this just a user fault and you guys can help me?

arian

p.s.: appears in both python2.4 and 2.5
Jan 27 '08 #1
0 1226

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John J. Lee | last post by:
1. Why do I get this in my minibuffer when I do C-c C-c in a python-mode buffer containing the following valid Python code? Wrong type argument: sequencep, cpython ----START #!/usr/bin/env...
0
by: jblazi | last post by:
The Python mode for Emacs works nicely on my own machine but it does not work entirely correctly in my school. We use a Novell network and that may cause some problems. Shen I am editing a Python...
2
by: John Fouhy | last post by:
Since Python has no explcit ends to blocks, emacs doesn't always know the right indentation level to use. And <del> doesn't seem to be very consistent (it always seems to go back 8 characters,...
1
by: Li Daobing | last post by:
Hello, I want to use fold-mode or hideshow mode under emacs, but it doesn't work. Cound you tell me how to do this? Thank you. Li Daobing
1
by: Marcio Rosa da Silva | last post by:
Hi all, My first try on using RST to write an email. so I can (will) make mistakes :-) I am experiencing the problem shown in this thread_ of the `python-mode`_ discussion list hosted at...
3
by: John J Lee | last post by:
Is it possible to get doctest-mode to work with mmm-mode and python-mode nicely so that docstrings containing doctests are editable in doctest-mode? In my utter e-lisp ignorance, I tried this: ...
20
by: weheh | last post by:
Dear web gods: After much, much, much struggle with unicode, many an hour reading all the examples online, coding them, testing them, ripping them apart and putting them back together, I am...
7
by: Michele Simionato | last post by:
I have noticed that the python-mode for Emacs that comes with the latest Ubuntu is missing the class browser. Moreover if works differently from the python-mode I was used to (for instance CTRL-c-c...
15
by: skip | last post by:
If you're an Emacs user who has used both python-mode.el (the python mode code distributed with Python and XEmacs) and python.el (the python mode code distributed with GNU Emacs), I'd like to get...
0
by: Malte Helmert | last post by:
skip@pobox.com wrote: One of the two modes (if memory serves, python.el) has an annoying bug/feature where indent-region is essentially implemented as "hit tab once on every line in the region"....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.