Skip to content
Back to formatted view

Raw Message

Message-ID: <49355510.60502@yahoo.de>
Date: 2008-12-02T15:32:32Z
From: Antje
Subject: Question to regular expressions

Hi there,

I know, this question is not directly an R-help question but probably someone 
can give me a hint how to deal with the following problem.

I have a vector with file/folder names and want to filter for all entries which 
  have 6 numbers in a row and nothing else.

folders <- c("folder1", "f2", "F234562", "12345678", "234567", "912345", "333")

I'd like to get only "234567" and "912345".
Can anybody help me creating a regex for this???

For example this regex:

regexpr("[^:digit:$]{6}", folders)

would match "F234562", "12345678", "234567", "912345"


Antje