ruby regex and grouping -


I got the text 'some-lesson here' and < / some - (\ W +) - here / all the work is fine, but if I use that expression, then

I will call it / some - (? , it increases an error undefined (? ...) sequence?

What am I doing?

(Ruby 1.9.2)

All this is from my innate Yes, I have used RVM and my Ruby version 1.9.2 is in progress. But I have tested that expression where it runs in footer ruble 1.8.7 in ruble. Ruby 1.8.7 and Ruby 1.9.2 have a different regular expression engine. On <1.8.7 No

It seems to me that you are looking at the wrong Ruby. Do you have RVM installed?

1.9.2

  & gt; & Gt; RUBY_VERSION = & gt; "1. 9.2" & gt; & Gt; S = 'Some-Text-Here' = & gt; "Some text here" & gt; & Gt; / Something - (? & Lt; group_name & gt; \ w +) - here = / ~ s = & gt; 0 & gt; & Gt; Group_name # = & gt; "Text"   

1.8.7

  & gt; & Gt; RUBY_VERSION = & gt; "1.8.7" & gt; & Gt; S = 'Some-Text-Here' = & gt; "Some text here" & gt; & Gt; / Something - (? Group_name & gt; \ w +) - here / = ~ s syntax error: compile error (irb): 2: undefined (? ...) sequence: / something - (? & Lt; Group_name & gt; \ w +) - From here (IRB): 2    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -

java : convert string value to int -