Rearrange the word and numbers at the beginning of each line



  • This text was written with the help of on Google Translate, so sorry for any errors.
    I have one text in which each line whitten the name of the fiction, date, rating, number of comments and the number of favorites. I need to take the word “favs” and numbers (specifically, it has the form (Favs: 2457 or Favs: 547)) and rearrange in the beginning of each line. How to do it?



  • Open Search->Replace. Make sure Search Mode is set to “Regular Expression”. Search for ^Favs: (\d+). Replace with $1 Favs:. This will search for the term “Favs: " at the beginning of a line followed by a sequence of digits. The digits part \d+ is put in brackets so it will be retained for use in replacement. In the replacement $1 is a placeholder for the digits retained in search. The text " Favs:” will be added as well (change to your liking).



  • Unfortunately, nothing happened. It shows that 0 occurrense was replaced. Here is an example of the 2 lines of text.

    A Different Halloween by robst reviews Could a chance meeting change history? What would a different Halloween in 1981 mean for wizarding Britain? Harry Potter - Rated: T - English - Chapters: 20 - Words: 124549 - reviews : 4042 - Favs: 7160 - Follows: 4229 - Updated: May 26 2012 - Published: Oct 31 2010 - [Harry P. Hermione G.] - Complete

    A Different Universe by dunuelos reviews Offshoot of “Stories of the Lone Traveller” from this site. Harry with help from an alternate version of himself begins to take back his life. There will be some M material in this one. Lemons found AFFO story ID 600098990. Harry Potter - Rated: M - English - Romance - Chapters: 23 - Words: 91164 - reviews : 617 - Favs: 1439 - Follows: 1887 - Updated: Aug 19 2014 - Published: Mar 14 2010 - Harry P. Hermione G.



  • Why didn’t you provide your sample lines of text when you first asked the question?



  • @Scott-Sumner I’m sorry, I did not think about it. I gave an example of text (2 lines of text).



  • If you follow basically what gerdb42 said to do, and use the following, it should work:

    Find what: ^(.+?)(Favs: \d+ - )(.+)
    Replace with: \2\1\3


Log in to reply