简体   繁体   中英

Regular expression mode find and replace in kate

I have huge file which compose like this:

This line is wrong, because the name after the code, for example: (20000000) NAME

where NAME does not recur in other line's fragments (example 1):

;100000;(20000000) Face wash su Acai uogomis Ziaja Jagody Acai 200 ml, (26700000) Face rinse gel Avene 75 ml, (26000000) Face tonic Alcina Skin Manager AHA Effect 50 ml, (30000000) Moisturing face lotion Tony Moly The Chok Chok Green Tea 160 ml, (31000000) Cleansing micel water Jowae Micellar Cleansing Water 400 ml

This line is correct, because all names after codes goes the same (example 2):

;100001;(20000000) Face wash su Acai uogomis Ziaja Jagody Acai 200 ml, (20000000) Face wash su Acai uogomis Ziaja Jagody Acai 200 ml, (20000000) Face wash su Acai uogomis Ziaja Jagody Acai 200 ml, (20000000) Face wash su Acai uogomis Ziaja Jagody Acai 200 ml

All fragments on one line of file are separated by codes like this (888888888), after this code following 1-5 words name, which have been the same in all fragments.

Goal is find all lines, whit the same names.

I used for this purpose regexp (where "Face wash" is the NAME:

^;([0-9]{5,12};(\([0-9]{6,12}\).Face wash.*){1,20})$

but it's was find all lines with name which are just in first fragment

I think wrong part of regexp is .*

How to change .* if I want to find lines with same name of fragments (like example 2), but not to find fragments with not same names (like example 1)

PS coma (,) is unreliable delimiter the only reliable delimiter is (35465468) number in brackets that is followed by NAME

Sorry for not clear question. I find solution:

^;[0-9]+;(\([0-9]+\)[0-9a-zA-Z,\/ ]*Face wash[0-9a-zA-Z,\/ ]*){1,24}$

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