Hello! I'm having trouble defining proper regex syntax to make mass conditional appends. Actually I'm a total noob when it comes to regex so please bear with me as I learn.
Example occurrences to edit (across multiple files)
The "blahblah" part is always at the start of the lines I wish to edit, then sometimes some space(s) but sometimes not, and then a random number of varying length.
What I want to do is simply append a "0" to each number of each line that starts with "blahblah". Output would be;
Hopefully somebody can save me from having to manually edit those lines.
Use the regular expression (^blahblah *\d+) and replace it with \10
Now some explanation. ^blahblah is the beginning of the line and the part you want to match, the space and asterisk matches 0 or more spaces, \d+ matches 1 or more digits. The entire thing is wrapped in parenthesis to mark everything it matches as group 1. When replacing, \1 uses the text from group 1, and 0 is the zero you want to append at the end.
Note: Be careful when running this. If you run it more than once it will append a zero each time.
Worked like a charm.
Thank you for your fast response and explanation. This has saved me from hours of tedium.