Navigation: TextEd > Regular expressions >

Replace variables

 

 

 

 

$0, $1, $2... (Matched substring)

 

We can use found substrings in the replace field. To catch a found substring use

 

  $0 - match any substring

  $1 - match first substring

  $2 - match second substring

  ...
 

If we have a text like below:

 

  Text123

  Text234

  Text345

 

And we want to change it into:

 

  123: Text

  234: Text

  345: Text

 

We identify the two substrings "numbers" and "characters" by using (\w+)(\d+) and catch them by using $1 and $2 in the replace field:

 

  Find: (\w+)(\d+)
  Replace: $2: $1

 


 

$Count (Replace count)

 

E.g. we have a text on several lines and we want to add a number on every line.

 

  A line...

  Another line...

  And another line...

 

We use:

 

  Find: (^[a-zA-Z .]+)

  Replace: $Count. $0


and we get:

 

  1. A line...

  2. Another line...

  3. And another line...

 

$DateTime        - insert long format date and time.
$Date            - insert short format date.
$Time            - insert the current time in hours, minutes and seconds.


 


 


 

 

 

 

Copyright © 2024 Rickard Johansson