# Why does this regular expression match?

**URL:** <https://www.ruby-forum.com/t/why-does-this-regular-expression-match/54620>\
**Category:** Ruby\
**Created:** [March 10, 2006, 5:38am UTC](https://www.ruby-forum.com/t/why-does-this-regular-expression-match/54620 "2006-03-10T05:38:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dplante](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ecccb3/32.png) [@dplante](https://www.ruby-forum.com/u/dplante)\
**Post date:** [March 10, 2006, 5:38am UTC](https://www.ruby-forum.com/t/why-does-this-regular-expression-match/54620/1 "2006-03-10T05:38:52Z")

</div>

Using Test::Unit:

r1 = /a\*/  
assert\_nil,‘A’ =~ r1

The error I get implies that it would match in the same way that the  
following would match  
‘a’ =~ r1

Can anyone offer any suggestions?

Thanks!  
Dominique

ps. done a google search on Test::Unit lately?

---

<div class="post-metadata">

**Author:** ![dplante](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ecccb3/32.png) [@dplante](https://www.ruby-forum.com/u/dplante)\
**Post date:** [March 10, 2006, 5:51am UTC](https://www.ruby-forum.com/t/why-does-this-regular-expression-match/54620/2 "2006-03-10T05:51:01Z")

</div>

The asterisk means “Zero or more of these”. You may want to use /a+/  
(One or more 'a’s).
