# \[Bug #3319\] Regexp#union$B$N@bL@$HF0:n$G?)$$0c$$$,$"$k!#(B

**URL:** <https://www.ruby-forum.com/t/bug-3319-regexp-union-b-n-bl-hf0-n-g-0c-k-b/188862>\
**Category:** Development\
**Created:** [May 19, 2010, 2:43pm UTC](https://www.ruby-forum.com/t/bug-3319-regexp-union-b-n-bl-hf0-n-g-0c-k-b/188862 "2010-05-19T14:43:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Masaya\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7bcc69/32.png) [@Masaya\_T](https://www.ruby-forum.com/u/Masaya_T)\
**Post date:** [May 19, 2010, 2:43pm UTC](https://www.ruby-forum.com/t/bug-3319-regexp-union-b-n-bl-hf0-n-g-0c-k-b/188862/1 "2010-05-19T14:43:23Z")

</div>

Bug #3319: Regexp#unione$B$N@bL@$HF0:n$G?)$$0c$$$,$"$k!#e(B  
[http://redmine.ruby-lang.org/issues/show/3319](http://redmine.ruby-lang.org/issues/show/3319)

e$B5/I\<\<Te(B: Masaya T.  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal  
Target version: 1.9.2  
ruby -v: ruby 1.9.2dev (2010-05-18 revision 27873) [i386-mswin32\_90]

e$BC.2H$G$9!#e(B

[ruby-dev:41247]e$B$+$i5DO@$7$?$b$N$G!“e(BRegexp#unione$B$N@bL@$HF0:n$G?)$$0c$$$,$”$j$^$9!#e(B

e$B?)$$0c$$$N6qBNE\*$JNc$K$D$$$F$O!"e(B  
[ruby-dev:41247]e$B5Z$Se(B[ruby-dev:41267]e$B$r;2\>H$/$@$5$$!#e(B  
e$BFbMF$H$7$F$O!"e(B  
e$B%I%-%e%a%s%H$G$OMWAG$N$I$l$K$G$b%^%C%A$9$k@55,I=8=$rJV$9$H$7$F$$$k$N$KBP$7!“e(B  
e$B\<BAu$G$O!“e(B  
e$B!&8eJ};2\>H$r4^$`\>l9g$KB\>$NMWAG$N1F6A$r\<u$1$F;2\>HBP\>]$,$:$l$k2DG=@-$,$”$k!#e(B  
e$B!&J8;z%3!\<%Ie(B10e$B$r0UL#$7$F$$$?e(B’\10’e$B$,8eJ};2\>H$H$7$F07$o$l$k2DG=@-$,$”$k!#e(B  
e$B!&F1$8L\>A0$NL\>A0IU$-Ja3M\<0=89g$r;}$DMWAGF1;N$Ne(Bunione$B$G$O%(%i!\<$K$J$k!#e(B  
e$B$H$$$C$?$b$N$G$9!#e(B

e$B%9%l%C%I$NCf$G$OF0:n$NJ}$r;EMM$H$9$k$H$$$&0U8+$G$7$?$N$G!“6l\<j$J$,$i1Q8l%I%-%e%a%s%H$N=$@5HG$r9M$($F$\_$^$7$?!#e(B  
e$B7k6Ie(B string-operated e$B$He(B probably  
e$B$rDI2C$7$?$@$1$G$9$,!”$3$s$J$N$G$$$$$s$G$7$g$&$+!)!#!#!#e(B

Return a Regexp object that is the string-operated union of the given  
patterns, i.e.,  
will probably match any of its parts. The patterns can be Regexp  
objects, in  
which case their options will be preserved, or Strings. If no  
arguments are given, returns /(?!)/.

---

<div class="post-metadata">

**Author:** ![Masaya\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7bcc69/32.png) [@Masaya\_T](https://www.ruby-forum.com/u/Masaya_T)\
**Post date:** [May 19, 2010, 3:15pm UTC](https://www.ruby-forum.com/t/bug-3319-regexp-union-b-n-bl-hf0-n-g-0c-k-b/188862/2 "2010-05-19T15:15:00Z")

</div>

e$B1sF#$G$9!#e(B

2010e$BG/e(B5e$B7ne(B19e$BF|e(B21:43 Masaya T.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> e$B%I%-%e%a%s%H$G$OMWAG$N$I$l$K$G$b%^%C%A$9$k@55,I=8=$rJV$9$H$7$F$$$k$N$KBP$7!“e(B  
> e$B\<BAu$G$O!“e(B  
> e$B!&8eJ};2\>H$r4^$`\>l9g$KB\>$NMWAG$N1F6A$r\<u$1$F;2\>HBP\>]$,$:$l$k2DG=@-$,$”$k!#e(B  
> e$B!&J8;z%3!\<%Ie(B10e$B$r0UL#$7$F$$$?e(B’\10’e$B$,8eJ};2\>H$H$7$F07$o$l$k2DG=@-$,$”$k!#e(B  
> e$B!&F1$8L\>A0$NL\>A0IU$-Ja3M\<0=89g$r;}$DMWAGF1;N$Ne(Bunione$B$G$O%(%i!\<$K$J$k!#e(B  
> e$B$H$$$C$?$b$N$G$9!#e(B

e$BEvLL$O!VM?$($i$l$?%Q%?!\<%s$K%-%c%W%A%c$,$"$C$?$iITDj!W$C$F$3$H$Ge(B  
e$B$I$&$G$7$g$&$+!#e(B

diff --git a/re.c b/re.c  
index dddd941…e272146 100644  
— a/re.c  
+++ b/re.c  
@@ -3195,6 +3195,7 @@ rb\_reg\_s\_union(VALUE self, VALUE args0)

- _pattern_s, i.e., will match any of its parts. The  
_pattern_s
- can be Regexp objects, in which case their options will be  
preserved, or
- Strings. If no patterns are given, returns `/(?!)/`.

- 
  - The behavior is unspecified if any given _pattern_ contains  
capture.
  - 
  - 

```
Regexp.union #=> /(?!)/

```

  - 

```
Regexp.union("penzance") #=> /penzance/

```

---

<div class="post-metadata">

**Author:** ![Masaya\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7bcc69/32.png) [@Masaya\_T](https://www.ruby-forum.com/u/Masaya_T)\
**Post date:** [May 19, 2010, 4:17pm UTC](https://www.ruby-forum.com/t/bug-3319-regexp-union-b-n-bl-hf0-n-g-0c-k-b/188862/3 "2010-05-19T16:17:39Z")

</div>

e$B%A%1%C%He(B #3319 e$B$,99?7$5$l$^$7$?!#e(B (by Masaya T.)

e$BC.2H$G$9!#e(B

probablye$B$O9s$+$C$?$G$9$M!#$9$$$^$;$s!#e(B  
e$BBe0F$“$j$,$H$&$4$6$$$^$9!#$3$l$G8D?ME\*$K$OFC$KITK~$”$j$^$;$s!#e(B

* * *

[http://redmine.ruby-lang.org/issues/show/3319](http://redmine.ruby-lang.org/issues/show/3319)

---

<div class="post-metadata">

**Author:** ![Masaya\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7bcc69/32.png) [@Masaya\_T](https://www.ruby-forum.com/u/Masaya_T)\
**Post date:** [May 20, 2010, 3:58pm UTC](https://www.ruby-forum.com/t/bug-3319-regexp-union-b-n-bl-hf0-n-g-0c-k-b/188862/4 "2010-05-20T15:58:26Z")

</div>

e$B%A%1%C%He(B #3319 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!\<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B  
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

This issue was solved with changeset r27929.  
Masaya, thank you for reporting this issue.  
Your contribution to Ruby is greatly appreciated.  
May Ruby be with you.

* * *

[http://redmine.ruby-lang.org/issues/show/3319](http://redmine.ruby-lang.org/issues/show/3319)
