FAQ Database Discussion Community


SQL: match a string pattern irrespective of it's case, whitespaces in a column

mysql,sql,regex,agrep
I need to find the frequency of a string in a column, irrespective of its case and any white spaces. For example, if my string is My Tec Bits and they occur in my table like this, as shown below : 061 MYTECBITS 12123 102 mytecbits 24324 103 MY TEC...

String matching records to count all instances in a dataframe

r,reshape2,stringr,agrep
I am trying to extract all strings from rows in a dataframe that match certain criteria for example how many words are match 'corn' in each row. Here is the input. install.packages('stringr') library(stringr) dataset <- c("corn", "cornmeal", "corn on the cob", "meal") y<- c('corn',"corn","mean","meal") id<- c(1,2,3,4) dataset <- data.frame(id,dataset,y) id...

How do I match a column of a dataframe of a particular length with another vector which has certain key-words to match to?

regex,r,pattern-matching,dataframes,agrep
My dataframe Expenses is as shown below : date name expenditure type 23MAR2013 KOSH ENTRP 4000 COMPANY 23MAR2013 JOHN DOE 800 INDIVIDUAL 24MAR2013 S KHAN 300 INDIVIDUAL 24MAR2013 JASINT PVT LTD 8000 COMPANY 25MAR2013 KOSH ENTRPRISE 2000 COMPANY 25MAR2013 JOHN S DOE 220 INDIVIDUAL 25MAR2013 S KHAN 300 INDIVIDUAL 26MAR2013...

strsplit with non-character data

r,reshape,reshape2,strsplit,agrep
1I want to do a strsplit on one variable ID1 to split into ID1_s1 and ID1_s2 and I need to get rid of the strings that are in brackets. # dummy data df1 <- data.frame(ID1=c("Gindalinc","Xaviertechnolgies","anine.inc(Nasq)","Xyzinc"), y=1:4) strsplit(df1$ID1, "\\(") How can i do a strplit to separate the ID1 based into...

agrep working with del, ins arguments

r,arguments,string-matching,agrep
How can "abteam" with "ab" be matched using this code? agrep("abteam",c("acb","abd","ab"),value=T,ignore.case = TRUE,max = list(del = 10, ins = 10, sub = 10)) The result is character(0), though I specified del=10, ins=10. What is the problem? How does agrep work?...

agrep string matching in R

r,string-matching,tm,agrep,qdap
I have two list of some product names. My problem is "Operating system" is matching with "system", "cooling system",etc. But it has to match only with "Operating","OS". Another example is "Key Board" should be matched with "key" or "KB" but not with "Mother Board" or just "Board". How to give...