VS 2010 Loop Through The Results Of Capture Group Regex Query?

Apr 29, 2012

I'm trying to find a way where i can make it loop through the results of my capture group regex query.

For instance if i have this:

VB.NET
Dim matches = Regex.Matches("<h1><span>test</span></h1>", "(?<=<h1>(<span>)?)(?<data>.+)(?=(</span>)?</h1>)")For Each item In matches.OfType(Of Match)()Console.WriteLine(item.Value)Next

And i'm trying to get the contents of <data>, how do i do it without it printing out the junk before it and after it?

quantifier isn't working, its supposed to make the <span> tag optional in the query, but it isn't.

View 2 Replies


ADVERTISEMENT

VS 2010 : Regex Group Value Loop?

Oct 8, 2011

(<td [^>]+>
ss|[^, ]<a href=""http://www.test.com/member.php?action=profile[^>]+>(<span [^>]+><strong>|<span [^>]+>|))[^<]+(<span [^>]+>|</strong></span></a>|</a>|</span></a>)

How do i turn that into a capture group so it only gets the text that is bold and removes the rest?Also how do i loop through all the result from that captured group text?

View 1 Replies

.net - RegEx - Use Capture Or Group?

Nov 4, 2010

Say I have this list (with unknown delimiters):

ABC-12345, DEF-34567; WER-12312
ERT-23423

I know the regex to mach what I need is: [A-ZÆØÅ]{3}-d{5}. But how do I use the Group or Capture of the .net Match class?

This is my first attempt:

Public Function ParseSites(ByVal txt As String) As List(Of String)
Const SiteIdRegEx = "([A-ZÆØÅ]{3}-d{5})"
Dim list As New List(Of String)

[Code].....

View 2 Replies

VS 2010 : Regex Results As Array?

Jun 30, 2010

which is the way to create all "matches" to array without this style:

ListBox1.Items.Add(Regex.Match(GetWebData).Value)
ListBox1.Items.Add(Regex.Match(GetWebData).NextMatch)
ListBox1.Items.Add(Regex.Match(GetWebData).NextMatch.NextMatch)

View 2 Replies

Concatenating A Variable With A Regex Group Match In Regex.replace?

Apr 5, 2012

I am having an issue where I am using regex.Replace to replace part of a string. The basic idea is that I want to capture the beginning of the string then replace the end of the string with a value from code. For an example pretend I have a string that says "Test Number " followed by number and I want to increment that number. I capture the "Test Number " but when I try to concatenate that capture with the new number it treats the capture ($1) as a literal and replaces the entire string with $1[new number].

[code]...

This will output "We are on Test Number 2", as expected. how I can use a variable in the replacement string portion of the Regex.Replace when including a captured group?

View 1 Replies

VS 2010 : Xpath Query On A XML Returns 0 Results?

Nov 13, 2011

I've converted an html to XML and now i want to get all the child nodes nested within a DIV element with a specific attribute (class="itemInfo").Because the html that the XML is based on changes from time to time i want to use a more "safe" relative root,
(something like : "//div[@class='itemInfo']").Problem is that i always get 0 nodes ...

Dim doc As New System.Xml.XmlDocument()
doc.Load("products.xml")
Dim root As System.Xml.XmlElement = doc.DocumentElement

[code]....

View 6 Replies

Showing Results Of A Search Query In Visual Basic 2010 Professional Edition?

Sep 24, 2011

I wanted to know how to write a query in data grid control. So far I've seen alot of forums but they are related to either 2008 vb or vb 6. how to write a query in the datagrid control which will search for an id in the database of access and present it.

View 2 Replies

Results From Query - Populate Textbox Controls With Query Result?

Mar 11, 2010

how to take a query that returns a single row of data and load that data into textbox controls.I know about ExecuteScalar but it is only good for a single column of data from the query.

View 2 Replies

Extract And Replace Named Group Regex?

Dec 29, 2010

I was able to extract href value of anchors in an html string. Now, what I want to achieve is extract the href value and replace this value with a new GUID. I need to return both the replaced html string and list of extracted href value and it's corresponding GUID.

My existing code is like:
Dim sPattern As String = "<a[^>]*hrefs*=s*((""(?<URL>[^""]*)"")|('(?<URL>[^']*)')|(?<URL>[^s]* ))"

[code]......

View 1 Replies

Regex Match 5 And 10 Char Zip Code In 1 Group

Dec 28, 2011

I'm using this code

[Code]...

I need it to match both 12345 (5 char zip) and 12345-1234 (10 char zip) in 1 single group. Is that possible?

[Code]...

View 1 Replies

Regex Matching And Results?

Apr 16, 2009

how would i get this USERNAME, USERID from this string:

Code:
<a href="javascript:attackWindow('USERNAME','USERID','50','RANDSTRING', 'RANDSTRING2')">

Adding the USERNAME to listbox, and then USERID into an array separated by a space.

View 2 Replies

.net - Defining RegEx To Capture Line Definition From INI File

Feb 18, 2010

defining an expression to capture the four numerics per line that define the lines on a map.

59.684 -4.251 59.575 -5.576
59.575 -5.576 59.437 -6.899
59.437 -6.899 59.27 -8.218

[Code]....

View 3 Replies

Regex - Capture The Repeating Data Using A Regular Expression In .Net?

Feb 7, 2011

I'm trying to find the right RegEx to capture some (potentially) repeating data. I don't know how many times it will repeat. If I give an exanple of the data and what I want to capture can anyone point me in the right direction? It's the .Net regex engine (Visual Basic)

[Code]...

View 1 Replies

RegEx - How To Group Multiple Email Addresses And Usernames

Aug 4, 2009

I have the following text that I am trying to parse:
"user1@emailaddy1.com" <user1@emailaddy1.com>, "Jane Doe" <jane.doe@ addyB.org>,
"joe@company.net" <joe@company.net>

I am using the following code to try and split up the string:
Dim groups As GroupCollection
Dim matches As MatchCollection
Dim regexp1 As New Regex("""(.*)"" <(.*)>")
matches = regexp1 .Matches(toNode.InnerText)
For Each match As Match In matches
groups = match.Groups
message.CompanyName = groups(1).Value
message.CompanyEmail = groups(2).Value
Next

But this regular expression is greedy and is grabbing the entire string up to the last quote after "joe@company.net". I'm having a hard time putting together an expression that will group this string into the two groups I'm looking for: Name (in the quotes) and E-Mail (in the angle brackets).

View 4 Replies

VS 2008 Regex Matching And Results?

Apr 17, 2009

i'm really new at the VB language only been doing for around 2 weeks.I hoping someone can help me with this, how would i get this USERNAME, USERID from a string

Adding the USERNAME to listbox, and then USERID into an array separated by a space. - I no how to do this part just the regex above remember i've only been doing for two weeks so i'm not very knowledged at this.

View 11 Replies

Group The Formula Field Results In Crystal Reports

Feb 1, 2012

I want Number of cartons and Pieces currently available in the stock that are about to expire in next 30 days and this is calculated based on expiry date...I have used formula field on crystal report to calculate current stock like "stock.crtns_added - stock.crtns_removed" and "stock.pieces_added - stock.pieces_removed"....Now I want to group by item name, category and expirydate because based on these three columns there can be more than 1 entries in the database....I want that when there are more than one entries the formula should sum up all the cartons and pieces for same item of a category with same expiry date and on report it should display just 1 line showing available cartons and pieces that are about to expire

How can i do this?? How can I apply group clause on the formula field in crystal report to get sum of cartons or pieces for each item based on expiry date??

View 1 Replies

Start Button Loop A BackgroundWorker With Sleep OracleConnection Results After Each Loop Till Stop Button

May 29, 2012

I have this little application that runs a SQL query works great, now I want to have a Start Button run the and display results then System.Threading.Thread.Sleep(300 * 1000) for 5 min then run again and display results and loop till I buttonstop_click. unsure if the sleep is the best method.

[Code]...

View 2 Replies

VS 2008 Regex - Parse Out Some Links Via Search And Fill A Text Box With Said Results

Mar 25, 2009

What I'm trying to do is parse out some links via a google search and fill a text box with said results. This is the code I have in a module which I call upon inside of a command button.

Imports System.Text
Imports System.Text.RegularExpressions

Module Module1

[CODE]...

View 8 Replies

Group By Clause In Sql Query?

Aug 26, 2009

I have a table DailyTransaction in MsAccess as under: DTDate, DTTime, CustId, Description, Quantity, Price, Amount, AccountNumber, Name I want to extend following query with a Group By clause:I require to display all records in a Listview Group By CustId.Then I require to display all records in a Listview Group By AccountName.e how I can extend following query with Group By clause to achieve the required results

View 4 Replies

While Loop To Go Through Different Group Boxes With Radio Buttons

Nov 15, 2011

I am trying to write a program that will have different group boxes,

each representing a question, and each one has radio button choices

I am trying to write the program so that a while loop will go through each group box and check answers of radio button choices

the codes I want to know is the command to access different group boxes

and also how to keep each group box "seperate" enough that i can use same radio button names for all the group boxes...

View 3 Replies

How To Loop Through LINQ Results

May 17, 2010

I've got some code to try and loop through LINQ results, but it doesn't seem to be working.

HERE'S THE CODE

Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
''# the page contenttype is plain text'

[Code]....

View 1 Replies

VS 2008 For Loop Through Results?

Aug 26, 2009

I can't think of a better way to do this, what i have is this function:

vb.net
Function functionDealWithHiddenFields(ByVal HTML As String, ByVal numHiddenFields As Integer)

[Code].....

which usually contains: 4 so when i loop out the names, it loops the 4 results, 4 times, instead of just showing me the names 4 times so i can then store them

View 2 Replies

Get A Linq To Sql Group By Query Into The Asp.net Mvc View?

Dec 23, 2009

I have the following query that groups parking spaces by their garage, but I can't figure out how to iterate the data in the view.

Public Function FindAllSpaces() Implements ISpaceRepository.FindAllSpaces
Dim query = _
From s In db.spaces _
Order By s.name Ascending _

[code]....

The controller is taking the query object as is and putting it into the viewdata.model and as stated the view is not currently strongly typed as I haven't been able to figure out how to do this. I have run the query successfully in linqpad.

View 2 Replies

Sql Server Query To Group Records?

May 9, 2011

i would like to select from the following table:

PostTable

feed dateinserted count
box1 2011-05-28 11:00 1000[code].....

the total number of records for the previous day where the feed is, 1, 3 and 5 i.e.the feeds I need to retrieve totals for will just be selected based on what I need for instance it could be box4 and box 5...not specifically odd and even...I hope this makes it more clearer..what I have for all records:

select sum(count) as [total] from PostTable where Cast(dateinserted as DATE) =
CAST(getdate()-1 as DATE)

View 3 Replies

VS 2008 - Group In ListView (SQL Query)

Apr 14, 2010

I have a listview in which the View is set to Details. I have a module with a Sub that accepts a Listview and a sql query as arguments:

Public Sub PopulateListView(ByVal lvw As ListView, ByVal filtersql As String)
Dim li As New ListViewItem
Dim lvwColumn As ColumnHeader
Dim counter As Integer
[Code] .....

This is how I call the sub:
PopulateListView(lvwTranHistory, "SELECT AccountID,TransactionDate,TransactionAmt FROM [Transactions] WHERE GameSheetID = " & CurGameSheetID & ";")
I tried some stuff there to group by the accountid but it ain't working. How to get the grouping to work.

View 1 Replies

Need All Results From Query

Mar 15, 2011

I have setup an OleDbConnection and my query works just fine but the problem I am facing is that I want the entire query not just a certain row or column. I also would like to place this entire query into a blank excel spread sheet.[code]

View 1 Replies

Renaming Group Of Files Using Loop In Visual Basic?

Jun 25, 2012

I currently have these group of files I want to rename:

C:Users medinaDocuments estenviromentTestfolderfile1-1111.doc
C:Users medinaDocuments estenviromentTestfolderfile2-1111.doc
C:Users medinaDocuments estenviromentTestfolderfile3-1111.doc
C:Users medinaDocuments estenviromentTestfolderfile20-1111.doc

I have a text box on my form where a I would enter a string of text which will replace the '1111' to whatever the string is in the text box field.

So for example, On my app, in the text box field, I would enter 2222, then when I click on button1, it will rename file1-1111.doc to file1-2222.doc, file2-1111.doc to file2-2222.doc, etc.....

This is my VB code I currently have:

[Code]...

View 4 Replies

How To Group Distinct Columns In A Linq Query

Nov 4, 2010

The following data is created by joining two sql tables together:I would like to group together distinct rows of DateStamp/UserName/ StudentName/ InstructorName/TableName/PrimaryKey (I'll call this 'group records') and then group under these ColumnName/PreviousValue/NewValue (I'll call this 'subgroup records')The end result would be that I could iterate through the 'group records' - there would be 5. In each 'group record', I could then iterate through the 'subgroup records'. The 5 groups would contain 3, 2, 5, 2 and 1 subgroup records respectively.What would be the syntax to create a query to do this? Ideally this would be in a vb.net linq syntax.

View 1 Replies

Order By And Group By In A Linq To Objects Query?

Sep 28, 2010

How do I order by and group by in a Linq query?I tried..Dim iPerson = From lqPersons In objPersons Where Len(lqPersons.Person) > 0 Group lqPersons By key = lqPersons.Name Into Group Order By Group descending Select Group, key

For Each i In iPerson
tmp = tmp & vbNewLine & i.key & ", " & i.Group.Count
Next

[code].....

View 5 Replies

Formatting SQL Query Results?

Feb 3, 2009

If this is in the wrong section, I have a program that queries a database and puts the info in a specific format in a txt file. Now my problem comes w/ how to format the date.

Should I format the date in the SQL query OR is there a way to take the result from the query and format sometime before it is writen to the txt file? I'm not exactly sure how to do either. Would I need a subquery to get the desired date format?

[Code]...

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved