How to replace a value within a large string in R
<p>I have a long string (comes from a SQL query) that contains this phrase:</p>

<p>"AND RO.[TPID] = 18411436"</p>

<p>I want to replace the number portion each time I go through a loop. How do I exctract the pattern so I can perform a sub or str_replace?</p>

<p>When I run grep("[TPID] = ",x) it returns a 0 as it didn't find that pattern.
The length of the number also varies is it is not always 8 digits and I don't know the number so I can't just do a search for the number.</p>

<p>Thanks!</p>