简体   繁体   English

过滤文本框vb.net 2008中的选定行

[英]filter a selected line from textbox vb.net 2008

I want to extract from the textbox if the text is written like this: 如果文本是这样写的,我想从文本框中提取:

Title: DLF is now introducing amazing DLF_CITY_CENTRE in Gurgaon 标题:DLF现在在古尔冈引入了令人惊叹的DLF_CITY_CENTRE

Description: PROPERTY DETAIL The first mall of the National Capital 描述:财产详情国家首都的第一家购物中心
Region (NCR) is situated in Gurgaon along the Mehrauli Gurgaon Road. 地区(NCR)位于古尔冈的Mehrauli古尔冈路旁。
It also houses the 3-screen multiplex, DT Cinemas, and features a host 它还包含3屏多路传输,DT Cinemas,并带有主机
of restaurants such as Moti Mahal COMMON AMENITIES SPECIFICATIONS Moti Mahal等餐厅的常见设施规格
* The development has a total lettable area of 260,000 square feet and is currently anchored by the Lifestyle Department Store. *该开发项目的总可出租面积为260,000平方英尺,目前由生活方式百货公司进行固定。
* The mall also provides parking for up to 700 vehicles. *购物中心还提供最多700辆车的停车位。 For More Detail Please contact us…!!!! 欲了解更多详情,请联系我们…!!!! Mobile: 09990000000 手机:09990000000
Website: www.timberwala.com 网站:www.timberwala.com

And I want the only text which is in after Title, Description, Location, mobile, website and the content is dynamic. 我想要标题,描述,位置,移动电话,网站之后的唯一文本,并且内容是动态的。

Q:I am able to get the text in a textbox, but now I want to get the data from title, description, etc. to multiple textboxes like 问:我可以在文本框中获取文本,但是现在我想从标题,描述等获取数据到多个文本框,例如

title to textbox1 文本框1的标题
description to textbox2 对textbox2的描述

Your best bet would be to use regular expressions to break the string apart and parse it into the invidual fields you desire -- You don't have to use regular expressions, as you could use .NETs native string manipulations (such as SubString, etc) but Regular Expressions are much more flexible and powerful. 最好的选择是使用正则表达式将字符串分开并将其解析为所需的单个字段-您不必使用正则表达式,因为可以使用.NETs本机字符串操作(例如SubString等) ),但正则表达式更加灵活和强大。

I would recommend this thread for a primer on regular expressions: Learning Regular Expressions 我建议将此线程用作正则表达式的入门: 学习正则表达式

I can't vouch for RegEx Buddy which they mention in the thread, but I have indeed found Expresso VERY handy in working out expressions. 我不能保证他们在线程中提到的RegEx Buddy,但是我确实发现Expresso非常适合计算表达式。 It is free and available at: http://www.ultrapico.com/Expresso.htm 它是免费的,可以在以下网址获得: http : //www.ultrapico.com/Expresso.htm

Example using .NET string methods: 使用.NET字符串方法的示例:

Dim Title As String = TextBox1.Text.Substring(TextBox1.Text.IndexOf("Title:") + 6, TextBox1.Text.IndexOf("Description:") - 6).Trim()

(Really Simple) Example using Regular Expressions (make sure to Import System.Text.RegularExpressions) (非常简单)使用正则表达式的示例(确保导入System.Text.RegularExpressions)

Dim Description As String = Regex.Split(TextBox1.Text, "Description:", RegexOptions.Multiline And RegexOptions.IgnoreCase)(1).Trim

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM