首页 > 解决方案 > Replacing a certain number of characters after a match in regular expression

问题描述

I want to find any instance of

\/Network\/Cambric Corporate Center\/

and replace the next 8 characters with nothing. So something like this

\/Network\/Cambric Corporate Center\/1164.DEV1164

Turns into this

\/Network\/Cambric Corporate Center\/1164

I'm working with a baked in replace regular expression visual programming piece, and this is my first post to here ever so please ask if more info is needed. I basically just need it to look like this

\/Network\/Cambric Corporate Center\/1164

if there is another solution without having to use replace It is for a frequently updated mass source of data that I need to edit to make more compatible with arrays

标签: regex

解决方案


尝试(\/Network\/Cambric Corporate Center\/).{8}用 $1 替换以保留第一组,但不要保留其他任何内容。

这是替换的正则表达式:https ://regex101.com/r/F4Y4VD/1


推荐阅读