[英]Split a string with '[' and ']'
I would like to know the RegEx Split pattern (using C#) for a string which packed with [
and ]
. 我想知道使用[
和]
打包的字符串的RegEx Split模式(使用C#)。
For example, for the string: 例如,对于字符串:
This is my [word1] And this is my [word2]
I should get word1
and word2
. 我应该得到word1
和word2
。
Use regex /\\[(.*?)\\]/g
. 使用正则表达式/\\[(.*?)\\]/g
。 Given regex is in perl, similar is in other langauges too. 鉴于正则表达式位于perl中,其他语言也是如此。 Worked out here: https://regex101.com/r/zL0yW1/1 在这里工作: https : //regex101.com/r/zL0yW1/1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.