@@ -2712,6 +2712,18 @@ def test_search_anchor_at_beginning(self):
27122712 # With optimization -- 0.0003 seconds.
27132713 self .assertLess (stopwatch .seconds , 0.1 )
27142714
2715+ def test_search_anchor_at_beginning_line (self ):
2716+ # Test "^" anchor with UCS-1, UCS-2 and UCS-4 characters.
2717+ p = re .compile ('^a' , re .MULTILINE )
2718+ self .assertEqual ([m .span () for m in p .finditer ('a\n \xe0 a\n a' )], [(0 , 1 ), (5 , 6 )])
2719+ self .assertEqual ([m .span () for m in p .finditer ('a\n \u0430 a\n a' )], [(0 , 1 ), (5 , 6 )])
2720+ self .assertEqual ([m .span () for m in p .finditer ('a\n \U0001d49c a\n a' )], [(0 , 1 ), (5 , 6 )])
2721+
2722+ def test_search_anchor_at_beginning_line_at_end (self ):
2723+ # "^" matches the end of the string if the string ends with a newline.
2724+ p = re .compile ('^' , re .MULTILINE )
2725+ self .assertEqual ([m .span () for m in p .finditer ('a\n ' )], [(0 , 0 ), (2 , 2 )])
2726+
27152727 def test_possessive_quantifiers (self ):
27162728 """Test Possessive Quantifiers
27172729 Test quantifiers of the form @+ for some repetition operator @,
0 commit comments