In R, is there a better/simpler way than the following of finding the location of the last dot in a string?
x <- \"hello.world.123.456\"
g <- gregexpr(
Someone posted the following answer which I really liked, but I notice that they've deleted it:
regexpr("\\.[^\\.]*$", x)
I like it because it directly produces the desired location, without having to search through the results. The regexp is also fairly clean, which is a bit of an exception where regexps are concerned :)