top of page

regex to move string to the end of a line

Here's a demonstration of how to run a regular expression search which will take a string at the beginning of a line of text and move it to the end of the line. This search:


(\r\s{3,})([0-9]{2}:[0-9]{2})(.*$)


. . . finds a new line which begins with at least three whitespaces, ((\r\s{3,}) , a time code in the format ##:## ([0-9]{2}:[0-9]{2}), and then captures all text until the end of the line.



Then replace the text with:


\1 \3 \2


. . . the first string, followed by the third string in the parentheses, and ending the with second string.






Comments


bottom of page