数据表中的正则表达式匹配 [英] Regex match in Datatable

查看:547
本文介绍了数据表中的正则表达式匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要过滤基于Regex的数据表中的行和列.您能给我一些实现这一目标的方法吗?

I need to filter rows and columns in a Datatable based on Regex. Could you please give me some approaches to achieve the same.

如果正则表达式与行匹配,那么我需要从数据表中过滤掉那些特定的行

if regex matches  in rows , then i need to filter out those specific rows from the Datatable

如果regex与列中的匹配,那么我需要从数据表中过滤掉那些特定的列

if regex matches  in columns , then i need to filter out those specific columns from the Datatable

在表中循环是缓慢的操作,因此请尝试避免这种方法.

Looping through the table is slow operation, hence trying to avoid that approach.

预先感谢

此致

Ujjwal

-Ujjwal

推荐答案

正则表达式用于字符串.

Regex is made for strings. 

dataTable是它所说的表,而不仅仅是由字符串组成.

A dataTable is what it says a table and not consisting only from strings. 

您似乎在看DataTable,就好像它是电子表格一样,因为您告诉选择列.

It seems you are looking at a DataTable as if it is a spreadsheet because you tell selecting on columns. 

对不起,不是

请注意,正则表达式是查找数据最慢的方法之一.但是,如果要匹配的字符串很复杂,可能会非常有用.

Be aware that the Regex is one of the slowest methods to find data. However, it can be very useful if the string to match is complex. 

然而,DataTable除了循环外还有许多方法来查找数据;来自其中的DataView Rowfilter和Find是两个. 

The DataTable has however many methods to find data beside looping; from which the DataView Rowfilter and the Find are two. 


这篇关于数据表中的正则表达式匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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