[latex3-commits] [latex3/latex3] gh890: Correct \seq_(g)set_regex_extract: code (0b470f7ed)

github at latex-project.org github at latex-project.org
Wed Nov 27 08:53:57 CET 2024


Repository : https://github.com/latex3/latex3
On branch  : gh890
Link       : https://github.com/latex3/latex3/commit/0b470f7edf9224e951756e9e0b56aff13f68a215

>---------------------------------------------------------------

commit 0b470f7edf9224e951756e9e0b56aff13f68a215
Author: Joseph Wright <joseph at texdev.net>
Date:   Wed Nov 27 07:51:44 2024 +0000

    Correct \seq_(g)set_regex_extract: code


>---------------------------------------------------------------

0b470f7edf9224e951756e9e0b56aff13f68a215
 l3kernel/l3seq.dtx | 58 ++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 21 deletions(-)

diff --git a/l3kernel/l3seq.dtx b/l3kernel/l3seq.dtx
index d4d688ece..6e9190ebd 100644
--- a/l3kernel/l3seq.dtx
+++ b/l3kernel/l3seq.dtx
@@ -1476,36 +1476,52 @@
 %   }
 %    \begin{macrocode}
 \cs_new_protected:Npn \seq_set_regex_extract:Nnn #1#2#3
-  { \regex_extract:nnN {#3} {#2} #1 }
+  { \regex_extract_all:nnN {#3} {#2} #1 }
 \cs_generate_variant:Nn \seq_set_regex_extract:Nnn { c }
+\cs_new_protected:Npn \seq_gset_regex_extract:NNn #1#2#3
+  {
+    \group_begin:
+      \tl_set_eq:NN \l_@@_internal_a_tl #1
+      \regex_extract_all:NnN #2 {#3} \l_@@_internal_a_tl
+      \seq_gset_eq:NN #1 \l_@@_internal_a_tl
+    \group_end:
+  }
+\cs_generate_variant:Nn \seq_gset_regex_extract:Nnn { c }
 \cs_new_protected:Npn \seq_set_regex_extract:NNn #1#2#3
-  { \regex_extract:NnN {#3} {#2} #1 }
+  { \regex_extract_all:NnN {#3} {#2} #1 }
 \cs_generate_variant:Nn \seq_set_regex_extract:NNn { c }
+\cs_new_protected:Npn \seq_gset_regex_extract:NNn #1#2#3
+  {
+    \group_begin:
+      \tl_set_eq:NN \l_@@_internal_a_tl #1
+      \regex_extract_all:NnN #2 {#3} \l_@@_internal_a_tl
+      \seq_gset_eq:NN #1 \l_@@_internal_a_tl
+    \group_end:
+  }
 \cs_new_protected:Npn \seq_set_regex_split:Nnn #1#2#3
   { \regex_split:nnN {#3} {#2} #1 }
 \cs_generate_variant:Nn \seq_set_regex_split:Nnn { c }
+\cs_new_protected:Npn \seq_gset_regex_split:Nnn #1#2#3
+  {
+    \group_begin:
+      \tl_set_eq:NN \l_@@_internal_a_tl #1
+      \regex_split:nnN {#2} {#3} \l_@@_internal_a_tl
+      \seq_gset_eq:NN #1 \l_@@_internal_a_tl
+    \group_end:
+  }
+\cs_generate_variant:Nn \seq_gset_regex_split:Nnn { c }
 \cs_new_protected:Npn \seq_set_regex_split:NNn #1#2#3
   { \regex_split:NnN {#3} {#2} #1 }
 \cs_generate_variant:Nn \seq_set_regex_split:NNn { c }
-\group_begin:
-  \cs_set_protected:Npn \@@_tmp:w #1#2#3
-    {
-      \cs_new_protected:cpe { seq_gset_regex_ #1 :N #2 n } ##1##2##3
-        {
-          \group_begin:
-            \tl_set_eq:NN \exp_not:N \l_@@_internal_a_tl ##1
-            \exp_not:c { regex_ #1 :Nn #2 }
-              #3 {##2} {##3} \exp_not:N \l_@@_internal_a_tl
-            \seq_gset_eq:NN ##1 \exp_not:N \l_@@_internal_a_tl
-          \group_end:
-        }
-      \cs_generate_variant:cn { seq_gset_regex_ #1 : N #2 n } { c }
-    }
-  \@@_tmp:w { extract } n { }
-  \@@_tmp:w { extract } N \use:n
-  \@@_tmp:w { split } n { }
-  \@@_tmp:w { split } N \use:n
-\group_end:
+\cs_new_protected:Npn \seq_gset_regex_split:NNn #1#2#3
+  {
+    \group_begin:
+      \tl_set_eq:NN \l_@@_internal_a_tl #1
+      \regex_split:NnN #2 {#3} \l_@@_internal_a_tl
+      \seq_gset_eq:NN #1 \l_@@_internal_a_tl
+    \group_end:
+  }
+\cs_generate_variant:Nn \seq_gset_regex_split:NNn { c }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}





More information about the latex3-commits mailing list.