Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从regexp的角度获得字符串中的字符限定?_C#_.net_Regex_Visual Studio - Fatal编程技术网

C# 如何从regexp的角度获得字符串中的字符限定?

C# 如何从regexp的角度获得字符串中的字符限定?,c#,.net,regex,visual-studio,C#,.net,Regex,Visual Studio,这项任务对人眼来说很简单——确定字符是单词的一部分,是特殊符号还是数字的一部分。我们有一个未知语言的字符串,如阿拉伯语\汉语\英语或任何数字/代码的组合等。我们在regexp中有简单的限定符:\w表示单词^\d$为数字,其他为其他。我们有一个这样的API可以完成一半的工作:expr.IsMatchtext,position,但我们不能从中开始索引或结束索引。是否有一个vay可以从所选对象的regexp start\end simbols中获取,只提供其中字符的i索引?或者应逐字符手动迭代,并逐字

这项任务对人眼来说很简单——确定字符是单词的一部分,是特殊符号还是数字的一部分。我们有一个未知语言的字符串,如阿拉伯语\汉语\英语或任何数字/代码的组合等。我们在regexp中有简单的限定符:\w表示单词^\d$为数字,其他为其他。我们有一个这样的API可以完成一半的工作:expr.IsMatchtext,position,但我们不能从中开始索引或结束索引。是否有一个vay可以从所选对象的regexp start\end simbols中获取,只提供其中字符的i索引?或者应逐字符手动迭代,并逐字符执行thab forvard char?

lookbehinds是否与Match一起工作?它不是从给定的位置开始,好像它是一个新字符串吗?问题是确定包含给定字符的单词/数字的起始和结束位置。你能给出测试用例吗?123.432在字符索引0上,我们得到特殊字符;在1或2或3…或5上,我们得到范围为1到5的单词;在字符索引15上,我们得到123的位置作为一个数字,以此类推