[英]regex certain character notepad++
Let me get this short. 让我简短一点。 I have this document:
我有这个文件:
================================= =================================
Dealer PIN 57FG2119 Malaysia. ID [2DF88565] Filiphine. BBM : 5B7AF062
LINE :agungpra.
No hp:082187754243
Open agen, reseller & dropship
CS 1 : PIN 5353ABC2
CS 2 : SMS 085711439997
Fb : Griya Madinah
Fanpage : Madinah butik
Email : madinah_butik@ymail.com
Dermastore Group
Stokis VVIP Indonesia 100% Original
Pemesanan/konsultasi:
5A66BC4D (BBM) 081320232353 (SMS) 08114530052 (WA) @dermastorecoid (LINE)
*Viciadas em Moda, Maquiagem, Unhas Comprinhas, Viagens*ABC-SP
blogviciadasemcompras@gmail.com
================================ ================================
As we see. 如我们所见。 There's some pin BB.
有一些销BB。 8 pin BB characters.
8针BB字符。 I'm looking for a REGEX formula which be able to sort/save/block/keep all 8 characters and delete the rest.
我正在寻找一个REGEX公式,该公式能够排序/保存/阻止/保留所有8个字符并删除其余字符。 So the final result will be like this.
因此最终结果将是这样。 Pin BB only.
仅BB引脚。 8 characters only (with automatically have the enter or space of each line)
仅8个字符(每行自动具有回车或空格)
57FG2119
2DF88565
5B7AF062
5353ABC2
5A66BC4D
I'm really blank on it. 我真的很空白。 Really I need a help.
我真的需要帮助。 Thank you.
谢谢。
You actually can do this in a single regex. 实际上,您可以在单个正则表达式中执行此操作。
In Notepad++'s find-replace: 在记事本++的查找替换中:
.*?\\b([0-9A-Z]{8})\\b(?(?=.*?\\b[0-9A-Z]{8}\\b)|.*)
.*?\\b([0-9A-Z]{8})\\b(?(?=.*?\\b[0-9A-Z]{8}\\b)|.*)
$1\\n
$1\\n
This basically says "match a pin; if there are more pins after it leave them for the next match otherwise just consume the rest of the junk (ie tail of file after last pin)". 这基本上是说“匹配一个引脚;如果在将更多的引脚留给下一个匹配之后使用,则只消耗其余的垃圾(即,最后一个引脚之后的文件尾)”。
The regex .*?\\b([0-9A-Z]{8})\\b|.*
works as well, it is a bit simpler but will leave a blank line at the end (there the |.*
at the end matches the last bit of the input if no more pins are found). 正则表达式
.*?\\b([0-9A-Z]{8})\\b|.*
工作为好,实在是有点简单,但将在年底(在那里留下一个空行|.*
在如果找不到更多引脚,则end匹配输入的最后一位)。
For more info check out Notepad++'s regex support . 有关更多信息,请查看Notepad ++的regex支持 。
In your sample input the output is: 在样本输入中,输出为:
57FG2119
2DF88565
5B7AF062
5353ABC2
5A66BC4D
You cannot do that in a single regex.. 您不能在单个正则表达式中这样做。
Step 1: In Notepad++, press CTRL+H and check Search Mode 'Regular expression' below.. 步骤1:在Notepad ++中,按CTRL + H并选中下面的搜索模式“正则表达式”。
Step 2: Check 'Match case' and 'Wrap around' 第2步:检查“匹配情况”和“环绕”
Step 3: Fill 'Find what' box entry with 第3步:在“查找内容”框中填写
\b([0-9A-Z]{8})\b
Step 4: Fill 'Replace with' entry with 步骤4:填写“替换为”条目
$1\n
Step 5: Click 'Replace All' 步骤5:点击“全部替换”
Step 6: Again fill 'Find what' box entry with 第6步:再次填写“查找内容”框的内容
[\w\W]*?\b([0-9A-Z]{8})\b
Step 7: And fill 'Replace with' box with 第7步:并在“替换为”框中填写
$1\n
Step 8: Click 'Replace All' 步骤8:点击“全部替换”
Now you have your BB pins 现在您有了BB销
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.