regex - Escaped Periods In R Regular Expressions -



regex - Escaped Periods In R Regular Expressions -

unless missing something, regex seems pretty straightforward:

grepl("processor\.[0-9]+\..*processor\.time", names(web02))

however, doesn't escaped periods, \. intent literal period:

error: '\.' unrecognized escape in character string starting "processor\."

what misunderstanding regex syntax?

my r-fu weak point of beingness non-existent think know what's up.

the string handling part of r processor has peek within strings convert \n , related escape sequences character equivalents. r doesn't know \. means complains. want escaped dot downwards regex engine need single \ past string mangler. usual way of doing sort of thing escape escape:

grepl("processor\\.[0-9]+\\..*processor\\.time", names(web02))

embedding 1 language (regular expressions) within language (r) bit messy , more when both languages utilize same escaping syntax.

regex r

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -