简体   繁体   中英

Replacing multiple lines with regular expressions in NP++

I have a problem with using regexps in Notepad++. Simply - I don't how to make my own expression, which will do something like that: It has to change these lines

AAA BBB 433
BBB CCC 45
JJJ KK 23

and so on, to those lines:

AAA BBB 1
BBB CCC 1
JJJ KK 1

All in all - I want to change value in the last column (columns are separated with space) to a value '1'. But I can't make a valid formula to do that. Please help me.

Use:

(\s)\d+$

Replace with:

($1)1

And hit Replace All . This will replace every number that is at the end of a line (preceded by a column divider, that is, white-space) with 1 .

Note: you can also use \\s\\d+$ and replace with " 1" (without the quotes).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM