String Matching
Hey everyone,? ? I have been having an issue trying to find a specific string of text in a log of system messages. ?I have tried to use pmatch, match, and some regular expressions but all to no avail. ? I have a matrix / data.frame (either one, the file outputs a tens of thousands of rows with a single column) of strings in the following format with different items after INFO: ?"09:11:57.259 - Assay File Processing Thread - INFO - SolenoidCycleMessage: Addr = 0x03 " as an example I would like to match "SolenoidCycleMessage" searchString<-"SolenoidCycleMessage" matchString<-"09:11:57.259 - Assay File Processing Thread - INFO - SolenoidCycleMessage: Addr = 0x03"
pmatch(searchString, matchString)
[1] NA
match(searchString, matchString)
[1] NA
match(matchString, searchString)
[1] NA
grep(searchString, matchString, ignore.case=FALSE)
[1] 1
df<-as.data.frame(c(matchString, string1, string2)) df
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?c(matchString, string1, string2) 1 09:11:57.259 - Assay File Processing Thread - INFO - SolenoidCycleMessage: Addr = 0x03? 2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?23:12:43.22 - Test 3 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?test
grep(searchString, df, ignore.case=FALSE)
integer(0)
grep(searchString, c(matchString, string1, string2), ignore.case=FALSE)
[1] 1 Doe anyone have some input that could help? Thanks,? Kevin