1
0
Fork 0

Use rx for the regular expression

This commit is contained in:
Bram Schoenmakers 2023-12-23 15:31:23 +01:00
parent cabfd25d2e
commit f74b30f80e
Signed by: bram
GPG key ID: 0CCD19DFDC63258F

View file

@ -87,8 +87,9 @@ FastGPT with the following prompt:
(with-temp-buffer
(insert string)
(goto-char (point-min))
(while (re-search-forward "<b>\\([^<]*\\)</b>" nil t)
(replace-match (propertize (match-string 1) 'font-lock-face 'bold) t nil))
(let ((bold-match (rx (seq "<b>" (group (* (not "<"))) "</b>"))))
(while (re-search-forward bold-match nil t)
(replace-match (propertize (match-string 1) 'font-lock-face 'bold) t nil)))
(buffer-string)))
(defun kagi--format-output (output)