Capturing a specific repeated group

匆匆过客 提交于 2019-12-26 06:19:08

问题


i'm trying to capture a group (in notepad++) of digits.

Example:

StartOfLineCharacters[0..4 repeating groups of 32 digits and spaces]

How can i find all repeating groups starting with 0000 whatever the position of the group

Example: StartOfLineCharacters0001123456789012345678901234567800001234568901234567890123456780100123456789012345678901234567800001234567890123456789012345678

in this specific example I have 4 groups (groups starting in bold) where 2 groups start with 0000. It could be that not all groups are filled with characters.

I want to find all rows in a text file that contain 1 or more groups starting with these four zero's.

Hopefully someone can help me. I'm not new to regex but this is the first time i'm searching in repeating patterns and I want to capture all lines in one single regex (for future purposes). If it was for a single time I could use 4 regexes.

Kind regards


回答1:


Your example is one line:

00001123456789012345678901234567800001234568901234567890123456780100123456789012345678901234567800001234567890123456789012345678

and you mentioned in comments:

[Group1][Group2][Group3][Group4] IF 1 or more of these groups starts with "0000" the line should be bookmarked.

how long is length of Group1,2,3.. ? I think it is 5!

 ^((\d{5}){0,}0000\d(\d{5}){0,})

and I must mention: you missed 0 in the beginning of your numbers-line which I bold it!



来源:https://stackoverflow.com/questions/42369864/capturing-a-specific-repeated-group

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!