Page 1 of 1
					
				function *replace* could not catch $0, $1 in Ubuntu 14.04
				Posted: Fri Jan 02, 2015 11:59 am
				by 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---")
			 
			
					
				Re: function *replace* could not catch $0, $1 in Ubuntu 14.0
				Posted: Fri Jan 02, 2015 2:40 pm
				by Lutz
				Look at your code again. You probably mean:
Code: Select all
> 
(set 'str "---axb--ayb---")
(replace "(a)(.)(b)" str (append $3 $2 $1) 0)
(= str "---bxa--bya---")
"---axb--ayb---"
"---bxa--bya---"
true
> 
 
			
					
				Re: function *replace* could not catch $0, $1 in Ubuntu 14.0
				Posted: Mon Jan 05, 2015 6:35 am
				by 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"