I am trying to use regular expressions in R to remove text - either an 'X' or an 'X.' - from the front of a number. I am new to regular expressions and having a hard time getting this to work. I have tried every combination of X and . with or without the escape character that I could think of, including:
str_replace("X.4.89294e-05", "X.",'')Result"4.89294e-05"but for fails forstr_replace("X4.89294e-05", "X.",'')Result".89294e-05"str_replace("X.4.89294e-05", "[X.]",'')Result".4.89294e-05"str_replace("X.4.89294e-05", "[X/.?]",'')Result".4.89294e-05"str_replace("X.4.89294e-05", "[X//.?]",'')Result".4.89294e-05"str_replace('X.4.89294e-0','X/.{0,1}','')Result"X.4.89294e-0"str_replace('X.4.89294e-0','[X/.{0,1}]','')Result".4.89294e-0"
Any help would be greatly appreciated.