Page 1 of 1

Search and Replace entire line

Posted: Wed Sep 01, 2021 8:27 pm
by somebody2978
Hi,

I'm editing a text file and trying to make TextCrawler search a certain phrase or word, delete the entire line and be replaced by a different line.

Example,

The bus was carrying a lot of people.
The bus is stuck and cannot move forward.
The bus will be delayed.

TextCrawler would have to find only the word "bus" and replace all those lines with that word by "The car is parked" in each line, resulting in something like this:

The car is parked.
The car is parked.
The car is parked.


Can I do this with this program?

Re: Search and Replace entire line

Posted: Thu Sep 02, 2021 10:20 am
by DigitalVolcano
It would be something like this
-Regular Expression mode
- Dot matches newline OFF
- Multiline Anchors ON

RegEx

Code: Select all

^.*bus.*$
Replace:

Code: Select all

the car is parked

Re: Search and Replace entire line

Posted: Thu Sep 02, 2021 6:25 pm
by somebody2978
DigitalVolcano wrote: Thu Sep 02, 2021 10:20 am It would be something like this
-Regular Expression mode
- Dot matches newline OFF
- Multiline Anchors ON

RegEx

Code: Select all

^.*bus.*$
Replace:

Code: Select all

the car is parked
It does not work, it leaves residues of the previous text, have to clean the entire line before inserting the new text.