Re: Regexp Ruby selection



touffik@xxxxxxxxx wrote:
I thought the .. between 2 "line =~" was like (...) in rubular which
let catch the content ??

Generally in ruby .. denotes a range. Like starting_value .. end_value.
In this case though it denotes a flip flop, which is evil and should never
ever be used because it makes my head hurt. Here's what it does though:
some_loop {
do_something if foo .. bar
}
This will do nothing until foo is true. When foo is true it will do_something.
It will then keep doing_something in every iteration of the loop until bar
becomes true. After bar became true it will stop doing_something until foo is
true again.
So as a summary: It doesn't do what you thought it did. As a matter of fact it
doesn't do anything sane. So just keep as far away from it as possible.


HTH,
Sebastian
--
Jabber: sepp2k@xxxxxxxxxx
ICQ: 205544826

.



Relevant Pages

  • Re: Insert with response
    ... FooBar, there's no way and no need to put them in synch. ... column in the foo table to 250 calumns in the bar table. ... set statistics time off ...
    (microsoft.public.sqlserver.programming)
  • Re: Magic function
    ... processing objects created in root at depth 3 ... root obj2 at depth 3 ... processing objects created in foo at depth 2 ... processing objects created in bar at depth 0 ...
    (comp.lang.python)
  • Re: Any Clojure users here?
    ... (let [my-list (foo x)] ... If the stack depth is N when you call baz, it's only N+3 in bar and N+2 ... It is N+3 in map, but map creates a lazy sequence object rather than ... a Java method call. ...
    (comp.lang.lisp)
  • Re: Closing parenthesis in functions definition followed by its call
    ... return [bar, foo]; ... Evaluating the ArrayLiteral, the identifiers `foo` and `bar` must be resolved. ... The identifier `foo` is resolved on the VO, however `bar` cannot be resolved to an identifier and so a ReferenceError is produced. ...
    (comp.lang.javascript)
  • Re: from __future__ import absolute_import ?
    ... foo not in bar ... Unfortunately this is a side effect of using the os's directory structure to represent a python "package" structure. ...
    (comp.lang.python)