Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ regex get 2nd group

I have a tex with 32k lines like this example

A01.2 Some Text
A01.3 some Text
A01.4 3Some Text
A02.0 [some text]
B02.1 Text .05 example

I need to replace white spaces with ';' symbol.

I tried (\S{3}\.\d)(\s) but notepad++ highlights/gets both groupsB02.1 with whitespace.

1st question: how do i disable 1st group, or take only 2nd 2nd question: is there another expression do find only this white space?

Here is the real example:

like image 348
Emin Hasanov Avatar asked Mar 24 '26 09:03

Emin Hasanov


2 Answers

If you want to replace the whitespace by ;, so this B02.1 will be B02.1; using notepad++; since you're capturing the groups then use $ notation in the replace expression.

Find: (\S{3}\.\d)(\s) Replace: $1;

$1 is for the first captured group.

Hope it helps,

enter image description here

like image 116
albciff Avatar answered Mar 26 '26 01:03

albciff


  1. You disable the first group simply not grouping it:

    \S{3}\.\d(\s)
    

Otherwise, the look-behind may suite your case:

(?<=\S{3}\.\d)(\s)
like image 20
Andrea Salicetti Avatar answered Mar 26 '26 00:03

Andrea Salicetti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!