c#Regex-删除只开发特殊章程组合的字符串 [英] c# Regex- Remove string which developed only combination of special charter

查看:168
本文介绍了c#Regex-删除只开发特殊章程组合的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找正则表达式,我可以忽略只是所有特殊章程组合的字符串。



示例

 列表< string> liststr = new List< string>(){a b,c%d,,%%%%,'',&,'' etc ... 

我需要这个结果

  {ab,c%d} 


 。[A-Za-z0- 9]。* 

它至少匹配一个字母数字字符。这样做,它将采取任何字符串,不仅是符号/特殊字符。它执行您想要的输出,请参阅:演示


I am looking for regular expression by which I can ignore strings which is only combination of All special charters.

Example

List<string> liststr = new List<string>() { "a b", "c%d", " ", "% % % %" ,"''","&","''","'"}; etc...

I need result of this one

{ "a b", "c%d"}

解决方案

Use this one :

.*[A-Za-z0-9].*

It matches at least one alphanumeric character. Doing this, it will take any string that is not only symbols/special chars. It does the output you want, see here : demo

这篇关于c#Regex-删除只开发特殊章程组合的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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