1 | | Hi there, |
2 | | |
3 | | I have solved the problem. I have almost read a book about regular expression to solve the problem but it was quite interesting :) |
4 | | |
5 | | I have made some test using steveire report: |
6 | | |
7 | | {{{ |
8 | | In [3]: list(smart_split(r'This is "a person\'s" test.')) == [u'This', u'is', u'"a person\\\'s"', u'test.'] |
9 | | Out[3]: True |
10 | | |
11 | | In [4]: list(smart_split(r"Another 'person\'s' test.")) == [u'Another', u"'person\\'s'", u'test.'] |
12 | | Out[4]: True |
13 | | |
14 | | In [5]: list(smart_split(r'A "\"funky\" style" test.')) == [u'A', u'"\\"funky\\" style"', u'test.'] |
15 | | Out[5]: True |
16 | | |
17 | | In [6]: list(smart_split(r' now "j "n" Y"')) == [u'now', u'"j "', u'n', u'" Y"'] |
18 | | Out[6]: True |
19 | | |
20 | | In [7]: list(smart_split(r' now "j "n " Y"')) == [u'now', u'"j "', u'n', u'" Y"'] |
21 | | Out[7]: True |
22 | | |
23 | | In [8]: list(smart_split(r' now "j " n" Y"')) == [u'now', u'"j "', u'n', u'" Y"'] |
24 | | Out[8]: True |
25 | | |
26 | | In [9]: list(smart_split(r' now "j " n " Y"')) == [u'now', u'"j "', u'n', u'" Y"'] |
27 | | Out[9]: True |
28 | | }}} |
29 | | |
30 | | Thank you for the report steveire. |
31 | | |
32 | | Regards, |
33 | | |
34 | | Juan Antonio Infantes. |
| 1 | I am working on it. |