@@ -469,6 +469,27 @@ F ← ⌅(+|⌅(-|⟜-|×10+))
469
469
⍤⤙≍ 20 ⍜⌝F∘ 1 2
470
470
⍤⤙≍ 20 ⍜(⌝F1)∘ 2
471
471
472
+ # Regex
473
+ ⍤⤙≍ Lorem ⍜(regex"\\w+")∘ Lorem
474
+ H ← "Hello, world!!"
475
+ ⍤⤙≍ "world, Hello!!" ⍜regex⇌ ⊙H$ \w+
476
+ ⍤⤙≍ "Holle, wdlro!!" ⍜regex⍚(⊂⋅⊙⇌°□₃) ⊙H$ (\w)(\w+)
477
+ ⍤⤙≍ 0 ⍤⤙≍ H ⍜regex⟜⧻ ⊙H$ \d+
478
+ ⍤⤙≍ "@, w!!" ⬚@@⍜regex≡⊣ ⊙H$ \b([a-z])?\w*\s?
479
+ ⍤⤙≍ "HHello, wworld!!" ⍜regex≡(◇▽2⊣) ⊙H$ \b(\w)
480
+ ⍤⤙≍ ".H.e.l.l.o.,. . . .w.o.r.l.d.!.!." ⍜regex⋅@. "" H
481
+ # different replacement forms:
482
+ ⊙H $ (\w)(\w*)
483
+ ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex⍜≡⊢⍚⇌ # 2d, boxed strings
484
+ ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex(⍚⇌≡⊢) # 1d boxed strings
485
+ ⍤⤙≍ "bip, bip!!" ◡⍜regex⋅(□"bip") # boxed string
486
+ ⍤⤙≍ "*, *!!" ◡⍜regex⋅(□@*) # boxed char
487
+ ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(⊟◇⊸⇌⊢) # 2d strings
488
+ ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(◇⇌⊢) # 1d strings
489
+ ⍤⤙≍ "bip, bip!!" ◡⍜regex⋅"bip" # string
490
+ ⍤⤙≍ "*, *!!" ◡⍜regex⋅@* # char
491
+ ⋅◌
492
+
472
493
# Experimental!
473
494
474
495
# Un under
@@ -485,25 +506,3 @@ F ← ⌅(+|⌅(-|⟜-|×10+))
485
506
⍤⤙≍ [¯1 ∞ ¯2] [⍜𝄐⊟¯ 1 ∞ 2]
486
507
⍤⤙≍ [4 ∞ 5] [⍜(⊟⊙◌)+ 1 ∞ 2 3]
487
508
⍤⤙≍ [¯1 ∞ ¯2] [⍜(⊟⊙◌)¯ 1 ∞ 2]
488
-
489
- # Regex
490
- ⍤⤙≍ Lorem ⍜(regex"\\w+")∘ Lorem
491
- H ← "Hello, world!!"
492
- ⍤⤙≍ "world, Hello!!" ⍜regex⇌ ⊙H$ \w+
493
- ⍤⤙≍ "Holle, wdlro!!" ⍜regex≡(□⊂⋅⊙⇌°□₃) ⊙H$ (\w)(\w+)
494
- ⍤⤙≍ 0 ⍤⤙≍ H ⍜regex⟜⧻ ⊙H$ \d+
495
- ⍤⤙≍ "@, w!!" ⬚@@⍜regex≡⊣ ⊙H$ \b([a-z])?\w*\s?
496
- ⍤⤙≍ "HHello, wworld!!" ⍜regex≡(▽2°□⊣) ⊙H$ \b(\w)
497
- ⍤⤙≍ ".H.e.l.l.o.,. . . .w.o.r.l.d.!.!." ⍜regex⋅@. "" H
498
- # different replacement forms:
499
- ⊙H $ (\w)(\w*)
500
- ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡⍜⊢⍚⇌ # 2d, boxed strings
501
- # TODO: remove ∘ when the misoptimization is fixed
502
- ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(∘⍚⇌⊢) # 1d boxed strings
503
- ⍤⤙≍ "bip, bip!!" ◡⍜regex⋅(□"bip") # boxed string
504
- ⍤⤙≍ "*, *!!" ◡⍜regex⋅(□@*) # boxed char
505
- ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(⇌°□⊢) # 2d strings
506
- ⍤⤙≍ "olleH, dlrow!!" ◡⍜regex≡(⊟⊸⇌°□⊢) # 1d strings
507
- ⍤⤙≍ "bip, bip!!" ◡⍜regex⋅"bip" # string
508
- ⍤⤙≍ "*, *!!" ◡⍜regex⋅@* # char
509
- ⋅◌
0 commit comments