Skip to content
Back to formatted view

Raw Message

Message-ID: <4A9E57C7-DBFD-4189-82A9-093BD1DAA1B7@gmail.com>
Date: 2011-04-25T10:17:44Z
From: Gonçalo Ferraz
Subject: regular expression for nth character in a string

Hi, I have a string

"InTrouble"

and want to extract, say, the first two characters: "In"
or the last three: "blee"
or the 3rd, 4th, and 5th: "Trou"

Is there an easy way of doing this quickly with regular expressions in gsub, grep or similar?

Thank you for any help.

Gon?alo