Hey @ClaytonM what I’m looking for would need something more complex. I’m looking for situations in a large string where " bd" is immediately followed by another letter (for example " bdA"), and I want to replace it with " bd|" so that in this example the text would read " bd|A". And do that for every instance where bd is immediately followed by another letter.
I can make regex to find those situations, but I don’t know how to replace it without, using the example above, removing the “A” character, which I need to leave intact.
What I’d ideally like to do is find the instances where " bd" is followed by a letter and get the index of that instance within the larger string, extract from the index of that instance to 5 characters and then I’d be able to easily replace those 5 characters with 6 new ones (the original 5 plus the “|” character after the " bd"). It is basically a formatting thing, where every incidence of " bd" should be immediately followed by a “|” character, but a couple of times for external reasons there are a few instances that don’t have that format.
So again, these are the steps I need.
- Find a string via regex (" bd")
- If found output the index of that string (lets say the regex finds it has an index of “7”)
- Extract 5 characters starting with that index number as a substring (extract characters 7-12)
- Replacing the original regex find with that substring (replace 7-12 with the same charcters only now a “|” character is added after " bd")
- loop for all subsequent positive hits on that same regex (continue to look if other instances within the larger, original string)