R
RichardOnRails
Hi,
I got a routine that works fine at building an array of upper-case
string extracting from a string:
while not s.eos?
if s.skip(/[A-Z]+/)
aNewList << s.matched
else
s.skip(/[^A-Z]+/)
end
end
I'd like to say something like the following. But !r doesn't work.
Can a Regex be negated somehow?
r = /[A-Z]+/
while not s.eos?
if s.skip(r)
aNewList << s.matched
else
s.skip(!r) # Doesn't work, of course. What does?
end
end
Thanks in advance,
Richard
I got a routine that works fine at building an array of upper-case
string extracting from a string:
while not s.eos?
if s.skip(/[A-Z]+/)
aNewList << s.matched
else
s.skip(/[^A-Z]+/)
end
end
I'd like to say something like the following. But !r doesn't work.
Can a Regex be negated somehow?
r = /[A-Z]+/
while not s.eos?
if s.skip(r)
aNewList << s.matched
else
s.skip(!r) # Doesn't work, of course. What does?
end
end
Thanks in advance,
Richard