Logan Capaldo wrote:
> Regular expressions are a very powerful tool, but they do not describe
> the entire set of operations one would reasonably want to perform on a
> string. Or perhaps they do but in a needlessly complex way. I want to
> get the first letter (character?) of a sentence, in pure regexp terms
> I'd do this: str.match(/\A./)[0] It's needlessly cryptic. Note that I'm
> not trying to make a commentary on whether or not character string/byte
> string should be separate, just trying to point out that "use regular
> expressions" shouldn't always be the answer.
> 

irb(main):001:0> "It's needlessly cryptic."[/./]
=> "I"

Not disagreeing, just trying to get more credit for regexes.

irb(main):010:0> "It's needlessly cryptic."[/.{17}(.)/, 1]
=> "r"

That's a bit more cryptic.

-- 
      vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407