I need the RegEx expression for removing leading spaces on each line for many different files. I have tried many different expressions, but none have worked. Can anyone provide the correct syntax?
I am using Batch commands/Batch Editor feature where you enter the RegEx expression and replacement value.
I have the Regular Expression and Multi-Line Anchors checked.
I want to trim the leading spaces up to the first non-space character from every line, in every file in a specified Start Location (Folder).
I have tried ^[ ]+ and ^[ \t]+ but they don't work.
Any help is appreciated.
How do you remove leading spaces from multiple lines?
- DigitalVolcano
- Site Admin
- Posts: 1863
- Joined: Thu Jun 09, 2011 10:04 am
Re: How do you remove leading spaces from multiple lines?
It works for me with the settings you've suggested. Are you sure you haven't got something else limiting the search like a date or file filter?
txc file:
txc file:
Code: Select all
<?xml version="1.0" encoding="utf-16"?>
<TextCrawlerBatch Version="3.0">
<command name="FindRep" enabled="True">
<find xml:space="preserve">^[ ]+</find>
<replace></replace>
<flags>MultiLine</flags>
</command>
<command name="FindRep" enabled="True">
<find xml:space="preserve">^[ \t]+</find>
<replace></replace>
<flags>MultiLine</flags>
</command>
</TextCrawlerBatch>
Re: How do you remove leading spaces from multiple lines?
You were correct, thanks a bunch. I had a filter on as you said. I was going buggy trying to figure out what was wrong.