In R regular expressions, how could one have a regex evaluated not from the beginning of the target strings, but instead only from the nth word on?
For example, suppose one is interested in substituting any numbers in a string with the symbol
@. Then one could use gsub("\\d+", "@", string), like in:
gsub("\\d+", "@", "words before 879 then more words then 1001 again")
The result would be:
> "words before @ then more words then @ again"
Now, keeping up with that example, using regex, how could one make it so that only numbers that appear starting from the 4th word in the string would get substituted? So that the above example would return "words before 879 then more words then @ again" because 879 is the 3rd word in the target string?
FWIW, I found many questions on extracting and locating words, some on matching from the beginning versus from the end, some on getting the substring up to or from the nth word. But none on how exactly to only have regular expressions disregard the first n words of a string when looking for a pattern.