如何在c#中使用正则表达式拆分字符串。 [英] How to split string using regular expression in c#.

查看:141
本文介绍了如何在c#中使用正则表达式拆分字符串。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一个字符串

输入:Mynameisblablabla.Istayatblabla

现在我需要在c#中使用正则表达式,它会自动分割字符串进入

我的名字是blablabla。我一步一步地留在blabla

解决方案

你不能自动拆分

 Mynameisblablabla.Istayatblabla 



进入

我的名字是blablabla。我依旧使用正则表达式来处理blabla 

:你需要一个英文单词词典,以便找出每个单词的每个单词的结尾,而正则表达式没有任何设施。他们很好,但他们不是奇迹工人! :笑:



你需要自己做,但这不是一项简单的任务。只是为此任务有效地组织字典需要花费相当长的时间才能完成...



对不起,但是你没有什么可以自动完成的。


Hello,
I have a string
Input: Mynameisblablabla.Istayatblabla
Now i need a regular expression in c# where it automatically splits the string into
My name is blablabla. I stay at blabla
in single step.

解决方案

You can't sutomatically split

Mynameisblablabla.Istayatblabla


into

My name is blablabla. I stay at blabla

with a regex at all: you need a dictionary of English words in order to find out where each oif the individual wordas ends, and regular expressions don't have any facility for that. They are good, but they aren't miracle workers! :laugh:

You will need to do this yourself, but it's not going to be a simple task. Just organising the dictionary efficiently for this task is going to take quite some time to work out...

Sorry, but there is nothing automatic that you can do here.


这篇关于如何在c#中使用正则表达式拆分字符串。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆