p /\AQ/ =~ “aQ” # ==> nil
p /\A=|Q/ =~ “aQ” # ==> 1
Apparently, Joel VanderWerf recently wrote:
p /\AQ/ =~ “aQ” # ==> nil
p /\A=|Q/ =~ “aQ” # ==> 1
\A means beginning of the string (mostly the same as ^, except in
multiline mode), and it is lower precidence than |
Notice:
p /^Q/ =~ “aQ” # ==> nil
p /^=|Q/ =~ “aQ” # ==> 1
But:
p /^(=|Q)/ =~ “aQ” # ==> nil
p /\A(=|Q)/ =~ “aQ” # ==> nil
At least with ruby 1.6.8
Wes
Wesley J. Landaker wrote:
Apparently, Joel VanderWerf recently wrote:
p /\AQ/ =~ “aQ” # ==> nil
p /\A=|Q/ =~ “aQ” # ==> 1\A means beginning of the string (mostly the same as ^, except in
multiline mode), and it is lower precidence than |
Ah, thanks. I always expect | to have a higher prec than most other things.
“Joel VanderWerf” vjoel@PATH.Berkeley.EDU schrieb im Newsbeitrag
news:3EE8F814.5010101@path.berkeley.edu…
Wesley J. Landaker wrote:
Apparently, Joel VanderWerf recently wrote:
p /\AQ/ =~ “aQ” # ==> nil
p /\A=|Q/ =~ “aQ” # ==> 1\A means beginning of the string (mostly the same as ^, except in
multiline mode), and it is lower precidence than |Ah, thanks. I always expect | to have a higher prec than most other
things.
??? That’s exactly what Wesley wrote. Then I don’t understand your
initial question.
robert
I said lower precedence, but I really meant higher. (I was thinking
backwards as I typed that out, probably
The key, I think, was that that the expression was being evaluated
relation to | differently than the OP was expecting. =)
···
On Friday 13 June 2003 4:32 am, Robert Klemme wrote:
“Joel VanderWerf” vjoel@PATH.Berkeley.EDU schrieb im Newsbeitrag
news:3EE8F814.5010101@path.berkeley.edu…Wesley J. Landaker wrote:
Apparently, Joel VanderWerf recently wrote:
p /\AQ/ =~ “aQ” # ==> nil
p /\A=|Q/ =~ “aQ” # ==> 1\A means beginning of the string (mostly the same as ^, except in
multiline mode), and it is lower precidence than |Ah, thanks. I always expect | to have a higher prec than most other
things.
??? That’s exactly what Wesley wrote. Then I don’t understand your
initial question.
–
Wesley J. Landaker - wjl@icecavern.net
OpenPGP FP: C99E DF40 54F6 B625 FD48 B509 A3DE 8D79 541F F830