I have following practice problems. I would like to translate them to Japanese and German.
I don't know why this doesn't work, so I wrote the following small program. This works well.
(let ((finishp nil))
(while (null finishp)
(progn
(setq match-start (search-forward "$" nil t))
(setq match-end (search-forward "$" nil t))
(setq finishp (or (null match-start) (null match-end)))
(if (null finishp)
(progn
(kill-region match-start match-end)
(insert "\\(.*\\)$"))))))
But I am puzzled why this regexp ("\\$[^\\$]+\\$") doesn't match. Can anyone explain me that?
- The $200$ is the $\\green{\\text{whole}}$. We are trying to find the $\\pink{\\text{part}}$ that makes up $11\\%$ of it:
- The $25$ is the $\\green{\\text{whole}}$. We are trying to find the $\\pink{\\text{part}}$ that makes up $12\\%$ of it:
- ...
- The $\(.*\)$ is the $\(.*\)$. We are trying to find the $\(.*\)$ that makes up $\(.*\)$ of it:
- $\1$ は $\2$ です.私達はその $\4$ となるだけの $\3$ を探しています:
- The $200$ is the $\\green{\\text{whole}}$. We are trying to find the $\\pink{\\text{part}}$ that makes up $11\\%$ of it:
- The $\(.*\)$ is the $\(.*\)$. We are trying to find the $\(.*\)$ that makes up $\(.*\)$ of it:
- (query-replace-regexp "\\$[^\\$]+\\$" "$\\\\(.*\\\\)$")
I don't know why this doesn't work, so I wrote the following small program. This works well.
(let ((finishp nil))
(while (null finishp)
(progn
(setq match-start (search-forward "$" nil t))
(setq match-end (search-forward "$" nil t))
(setq finishp (or (null match-start) (null match-end)))
(if (null finishp)
(progn
(kill-region match-start match-end)
(insert "\\(.*\\)$"))))))
But I am puzzled why this regexp ("\\$[^\\$]+\\$") doesn't match. Can anyone explain me that?
Comments