Bugs item #1448325, was opened at 2006-03-12 09:46 Message generated for change (Comment added) made by donallen You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1448325&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Regular Expressions Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Don Allen (donallen) Assigned to: Gustavo Niemeyer (niemeyer) Summary: re search infinite loop Initial Comment: Given the attached test.csv file, the following program loops forever (can't even ^c): import re orig = open('test.csv') file_contents = orig.read() orig.close() find_line = re.compile(r'^(".*")?(,(".*")?)*\n') search_result = find_line.search(file_contents) print search_result.span() The corresponding tcl program works correctly: set orig [open test.csv r] set file_contents [read $orig] close $orig regexp -indices {^(".*")?(,(".*")?)*\n} $file_contents \ indices puts "Indices were $indices" Both tests were run on a TP G41 running Gentoo Linux. ---------------------------------------------------------------------- >Comment By: Don Allen (donallen) Date: 2006-03-12 10:22 Message: Logged In: YES user_id=1474165 If you eliminate the \n at the end of the regular expression, the python program works correctly (for this example; I am trying to use regular expressions to parse the .csv files generated by Microsoft Outlook, which contain eols inside fields, so I'm trying to find the eols *not* inside fields with this regexp, so I need the \n; I'll have to go to Plan B, I suppose). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1448325&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com