function *replace* could not catch $0, $1 in Ubuntu 14.04

Started by ssqq, January 02, 2015, 03:59:04 AM

Previous topic - Next topic

ssqq

When I test *repace* in ubuntu 14.04, I found following test would fail:



      (set 'str "---axb--ayb---")

      (replace "(a)(.)(b)" str (append $3 $3 $1) 0)

      (= str "---bxa---bya---")

Lutz

Look at your code again. You probably mean:



>
(set 'str "---axb--ayb---")
(replace "(a)(.)(b)" str (append $3 $2 $1) 0)
(= str "---bxa--bya---")

"---axb--ayb---"
"---bxa--bya---"
true
>

ssqq

yes, I write error code.



I found the int-option in replace is could not ignore like *regex*. if ignore the int-option, newLISP would make "find-str" as *literal str*, if add int-option, newLISP would treat *find-str* as *regex-str".



    (replace "(a)" "aabb" "c")

    => "aabb"

    > (replace "(a)" "aabb" "c" 0)

    => "ccbb"