且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

正则表达式,用于在 | 之后删除所有内容(带 | )

更新时间:2023-02-17 23:40:59

管道 | 是正则表达式中的特殊字符(意思是或"),你必须对它进行转义带有 \.

The pipe, |, is a special-character in regex (meaning "or") and you'll have to escape it with a \.

使用您当前的正则表达式:

Using your current regex:

\|.*$

我已经在 Notepad++ 中尝试过,正如您所提到的,它似乎运行良好.

I've tried this in Notepad++, as you've mentioned, and it appears to work well.