]> git.eshelyaron.com Git - emacs.git/commitdiff
* doc/lispref/searching.texi (Rx Notation): Fix example (bug#76731)
authorMattias EngdegÄrd <mattiase@acm.org>
Sat, 17 May 2025 09:12:31 +0000 (11:12 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 21 May 2025 06:06:26 +0000 (08:06 +0200)
The example purporting to match C comments was wrong.
Reported by Yue Yi, whose proposed remedy is used here.

(cherry picked from commit 2606e3dd994d2d75850630707c00c0156afced9a)

doc/lispref/searching.texi

index 7840fe77e605c08ae2e57012cdcae17935a73ff4..9e498b56bb48b67a889fa1040c718b21b6b6ad5c 100644 (file)
@@ -1030,13 +1030,13 @@ programming language:
 
 @example
 @group
-(rx "/*"                    ; Initial /*
+(rx "/*"                            ; Initial /*
     (zero-or-more
-     (or (not "*")          ;  Either non-*,
-         (seq "*"           ;  or * followed by
-              (not "/"))))  ;     non-/
-    (one-or-more "*")       ; At least one star,
-    "/")                    ; and the final /
+     (or (not "*")                  ;  Either non-*,
+         (seq (one-or-more "*")     ;  or some * followed by
+              (not (or "*" "/"))))) ;     neither * nor /
+    (one-or-more "*")               ; At least one star,
+    "/")                            ; and the final /
 @end group
 @end example
 
@@ -1047,7 +1047,7 @@ or, using shorter synonyms and written more compactly,
 @group
 (rx "/*"
     (* (| (not "*")
-          (: "*" (not "/"))))
+          (: (+ "*") (not (in "*/")))))
     (+ "*") "/")
 @end group
 @end example
@@ -1056,7 +1056,7 @@ or, using shorter synonyms and written more compactly,
 In conventional string syntax, it would be written
 
 @example
-"/\\*\\(?:[^*]\\|\\*[^/]\\)*\\*+/"
+"/\\*\\(?:[^*]\\|\\*+[^*/]\\)*\\*+/"
 @end example
 
 The @code{rx} notation is mainly useful in Lisp code; it cannot be