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.






Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page