Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7307
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: Ruby Regexp why this expression does not match? |
| Date | 2016-12-03 09:13 +0100 |
| Message-ID | <eafd5kFabknU1@mid.individual.net> (permalink) |
| References | <8318472d-4632-4a06-b4c7-348316425ffa@googlegroups.com> |
On 03.12.2016 05:51, vunangluc@gmail.com wrote: > I want to use this regex to match any block comment (c-style) in a string. > But why the below does not? > > > rblockcmt = Regexp.new "/\\*[.\s]*?\\*/" # match block comment > p rblockcmt=~"/* 22/Nov - add fee update */" > > ==> nil Because a dot is not special in a character class. Btw. why do you use Regexp.new and not write the expression directly? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar
Ruby Regexp why this expression does not match? vunangluc@gmail.com - 2016-12-02 20:51 -0800
Re: Ruby Regexp why this expression does not match? Robert Klemme <shortcutter@googlemail.com> - 2016-12-03 09:13 +0100
Re: Ruby Regexp why this expression does not match? vunangluc@gmail.com - 2016-12-03 00:28 -0800
Re: Ruby Regexp why this expression does not match? Robert Klemme <shortcutter@googlemail.com> - 2016-12-03 11:27 +0100
csiph-web