0

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

Description: PROPERTY DETAIL The first mall of the National Capital
Region (NCR) is situated in Gurgaon along the Mehrauli Gurgaon Road.
It also houses the 3-screen multiplex, DT Cinemas, and features a host
of restaurants such as Moti Mahal COMMON AMENITIES SPECIFICATIONS
* The development has a total lettable area of 260,000 square feet and is currently anchored by the Lifestyle Department Store.
* The mall also provides parking for up to 700 vehicles. For More Detail Please contact us…!!!! Mobile: 09990000000
Website: 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
description to textbox2

timrau
  • 22,578
  • 4
  • 51
  • 64

1 Answers1

0

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.

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. It is free and available at: http://www.ultrapico.com/Expresso.htm

Example using .NET string methods:

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)

Dim Description As String = Regex.Split(TextBox1.Text, "Description:", RegexOptions.Multiline And RegexOptions.IgnoreCase)(1).Trim
Community
  • 1
  • 1
codechurn
  • 3,870
  • 4
  • 45
  • 65