[英]Regex - Remove first 5 and last 4 digits
We are scanning in a card that needs to have the first 5 numbers removed and last 4 removed.我们正在扫描一张需要删除前 5 个数字和后 4 个数字的卡片。
Example card number (all numbers can can/will change).示例卡号(所有数字都可以/将会改变)。
2011698951650708 2011698951650708
So far we have ^.{5}(.{7})
and replacement $1
到目前为止,我们有^.{5}(.{7})
和替换$1
we are getting 98951650708
but want 9895165
我们得到98951650708
但想要9895165
Link to where I am testing regexstorm 链接到我正在测试regexstorm的位置
Using .NET使用 .NET
您正在寻找的正则表达式是:
\d{5}(\d+)\d{4}
Try this -尝试这个 -
(?<=\d{5})\d(?=\d{4})
https://regex101.com/r/XbiMFI/2 https://regex101.com/r/XbiMFI/2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.