Hi everyone,

Need some guidance on best way to loop through a RichTextBox line by line, and if the line meets a certain criteria format like “[PatientRecord###], then replace that line’s text with new [PatientRecord###].”
The issue now is that several Patient Record numbers are the SAME – for example, we have three [PatientRecord497]. Therefore, that limits the usefulness of an GetPrivateProfile API call which will grab only the first matching entry or using a generic Replace$ on the RichTextBox that again will only replace the first matching entry. So basically, thinking of maybe using almost a brute force approach that sets up a counter, starts at the beginning of the RichTextBox, and when it matches a “[PatientRecord###]” format force the first match to be “[PatientRecord001]”, increment the counter, and then the next match to be “[PatientRecord002]”, etc. Any sample code or logic advice greatly appreciated!