Message811
In the following test the first block matching
([^":]*?) contains quotas, but if expression is
([^":]*), it does not match at all. Greedy modifier
cannot affect operation success.
Test program:
import re
s='"file.name" "path/file"'
s2=re.sub(r'^"([^":]*)/([^":/\\]*)"', r'1 #\1#\n2 #\2#', s)
s3=re.sub(r'^"([^":]*?)/([^":/\\]*)"', r'1 #\1#\n2
#\2#', s)
print
"s='"+s+"'\n\n============================\ns2='"+s2+"'\n\n============================\ns3='"+s3+"'"
output (s2 is not changed - no match; s3's first block
contains quotas):
s='"file.name" "path/file"'
============================
s2='"file.name" "path/file"'
============================
s3='1 #file.name" "path#
2 #file#' |
|
Date |
User |
Action |
Args |
2008-02-20 17:17:13 | admin | link | issue668194 messages |
2008-02-20 17:17:13 | admin | create | |
|