Regex for processing leading spaces (notepad ++)

I have a line in a file that opens in notepad ++

  0 <? 0.00 - (multi) Salt

Note. There are 2 leading spaces at the beginning of the line.

Using the replacement of regular expressions in just one pass, I have to change the above line as follows:

0,0.00,multi,Salt   

I tried: replace

  ( \d*) <\? \d.\d\d - \(multi\) *

from

\1,\2,multi,

It works great. Only problem is adding leading space to every line in notepad ++

How to change my regular expression so as not to add a start space at the beginning of each line?

Note L I cannot use the option "Trim Leading space in notepad".

Can someone please help me with this?

Thanks in advance!

Note. There are more lines in my file, e.g.

  0 <? 0.00 - (multi) Salt  
  1 <? 0.00 - (multi) Vinegar   
  2 <? 0.00 - (multi) Salt and Vinegar  
  3 <? 0.00 - (multi) BBQ Sauce 
  4 <? 0.00 - (multi) Chilli Sauce  
  5 <? 0.00 - (multi) Hawaiian Sauce    
  6 <? 0.00 - (multi) Brown Sauce   
  7 <? 0.00 - (multi) Garlic Mayo and Herb Sauce    
  8 <? 0.00 - (multi) Mayo  
  9 <? 0.00 - (multi) Salad 
  10 <? 0.00 - (multi) Lettuce  
  11 <? 0.00 - (multi) Cabbage  

Tried the suggestions below

+4
3

Notepad ++, Regular expression Find and Replace! (. )

, :

^\h{2}(\d*)\h*<\?\h*(\d\.\d{2})\h*-\h*\(multi\)\h*

\1,\2,multi,

\h ( ). {2} ( ).

. :

enter image description here

. 1 , \h{2} \h{2,}:

^\h{2,}(\d*)\h*<\?\h*(\d\.\d{2})\h*-\h*\(multi\)\h*
+3
"  ( \d*) <\? \d.\d\d - \(multi\) *" 

: ( \d*). , : (\d*). ( ) , Salt.

+2

^\h+(\d+)\h*<\?\h*([\d.]+)\W+(\w+)\W+([\w\h]+?)\h*$See here .

0
source

Source: https://habr.com/ru/post/1617113/


All Articles