Moving Asterisk from End of Line to Beginning of Line Using Regular Expression

Question: I will go home.*
Answer: *I will go home.

In Notepad++ Find and Replace function, add the following:-
Find: (.*)(*s*)$
Replace with:*1

Explanation

Explanation:

  • (.*): Matches any number of characters (including whitespace) before the asterisk
  • (*s*): Matches the asterisk and any whitespace characters immediately following it
  • $: Matches the end of the line
  • 1: Refers to the contents of the first set of parentheses, which matches any characters before the asterisk
  • *: Adds an asterisk at the beginning of the matched string

Note: In Notepad++ search and replace function, you should select the Regular Expression option in the search mode to use this expression.