okkezSS
October 27, 2010, 12:45pm
1
Hello,
AFAIK, there are no possessive quantifiers in 1.9, so I expected a
syntax error from this:
re = /cats?+/
=> /cats?+/
It worked and it works, but the + is meaningless it seems:
re.match “cat”
=> #<MatchData “cat”>
re.match “cats”
=> #<MatchData “cats”>
re.match “catsssss”
=> #<MatchData “cats”>
re.match “cats+”
=> #<MatchData “cats”>
Interestingly, the + is “preserved”:
re.to_s
=> “(?-mix:cats?+)”
re.source
=> “cats?+”
Does this make sense to anyone?
Thanks,
Ammar
ammar
October 27, 2010, 12:48pm
2
On Wed, Oct 27, 2010 at 12:44 PM, Ammar A. [email protected]
wrote:
AFAIK, there are no possessive quantifiers in 1.9,
You are misinformed. Where did you get that information? Please see:
http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt
Kind regards
robert
ammar
October 27, 2010, 12:58pm
3
On Wed, Oct 27, 2010 at 1:47 PM, Robert K.
[email protected] wrote:
On Wed, Oct 27, 2010 at 12:44 PM, Ammar A. [email protected] wrote:
AFAIK, there are no possessive quantifiers in 1.9,
You are misinformed. Where did you get that information? Please see:
サービス終了のお知らせ
I don’t recall how I ended up with that “fact”. I was probably looking
at a very old version of that file, or confused by ({n,m}+, {n,}+,
{n}+ are possessive op. in ONIG_SYNTAX_JAVA only).
It makes perfect sense now, and quite a relief for my work.
Thanks,
Ammar
ammar
October 27, 2010, 1:38pm
4
On Wed, Oct 27, 2010 at 1:58 PM, Ammar A. [email protected]
wrote:
On Wed, Oct 27, 2010 at 1:47 PM, Robert K.
[email protected] wrote:
On Wed, Oct 27, 2010 at 12:44 PM, Ammar A. [email protected] wrote:
AFAIK, there are no possessive quantifiers in 1.9,
You are misinformed. Where did you get that information? Please see:
サービス終了のお知らせ
One more thing, Read Ruby
(http://ruby.runpaint.org/regexps#quantifiers ) doesn’t even mention
possessive quantifiers. Hmmm.
Not everything in Oniguruma is supported in ruby. I guess I need to
verify this further.
Thanks,
Ammar
ammar
October 27, 2010, 2:05pm
5
On Wed, Oct 27, 2010 at 2:58 PM, Robert K.
[email protected] wrote:
=> nil
What else do you need to verify?
I ran similar tests and they work as expected from possessives, so I’m
sure they are supported. I would like to see it clearly stated in ruby
documentation. I logged an issue about it for Read Ruby
Thanks again,
Ammar
ammar
October 27, 2010, 1:59pm
6
On Wed, Oct 27, 2010 at 1:38 PM, Ammar A. [email protected]
wrote:
One more thing, Read Ruby
(http://ruby.runpaint.org/regexps#quantifiers ) doesn’t even mention
possessive quantifiers. Hmmm.
Not everything in Oniguruma is supported in ruby. I guess I need to
verify this further.
irb(main):001:0> /a+a/ =~ “aaa”
=> 0
irb(main):002:0> /a++a/ =~ “aaa”
=> nil
What else do you need to verify?
Cheers
robert