Regex Code Not Working

Apr 2, 2009

I have written a short piece of code to validate a UK NI number. The format is 2 upper case letters, followed by 6 digits followed by A,B, C or D. This code does not work, it never matches even when the string NI_Num is OK: [code]

View 2 Replies


ADVERTISEMENT

Regex :: RegularExpressions Not Working?

Jan 9, 2012

Here is my code:

Dim StartString As String = "Private Sub"
Dim EndString As String = "End Sub"
Dim SearchString As String = StartString & "(.+)" & EndString

[code].....

View 1 Replies

Regex.Replace Not Working?

Aug 15, 2011

I am trying to replace text in my xsl file. I have to replace all the http and https. But I can leave any links that start with <a href>

Ie; http://www.google.com has to replaced. But < a href="google.com">google.com</a> has to remain as it is.

I am using regex to find all the http(s) and a hrefs in the text. I am struck here.

My code is,

Dim href As New Regex("(<a.*?>.*?</a>)", RegexOptions.IgnoreCase)
Dim hrefs As New Regex("http(s)?://([w+?.w+])+([a-zA-Z0-9~!@#$\%^&*()_-=+\/?.:;',]*)?", RegexOptions.IgnoreCase)

[Code].....

I am trying to use Regex.Replace to replace my https. But I am unable to write the evaluate function.

My regex.replace replaces all the values with a single value.

View 4 Replies

HTML Tag Replacement Regex Not Quite Working Correctly?

Sep 14, 2009

This is a follow up to another question of mine. The solution I found worked great for every one of the test cases I threw at it, until a case showed up that eluded me the first time around.My goal is to reformat improperly formatted tag attributes using regex (I know, probably not a fool-proof method as I'm finding out, but bear with me).

My functions:
Public Function ConvertMarkupAttributeQuoteType(ByVal html As String) As String
Dim findTags As String = "</?w+((s+w+(s*=s*(?:"".*?""|'.*?'|[^'"">s]+))?)+s*|s*)/?>"

[code].....

View 2 Replies

C# - Remove Square Brackets And Single Quotes Regex Not Working

May 9, 2011

I have the following string [custID] = 'A99999999' I am trying the following to remove the square brackets and the single quotes Regex.Replace(sql, "/[[]']+/g", " ") but that's not working. I keep getting the same results Note: sql is a variable holding the string above. I want the result to be

View 5 Replies

Regex - .net Regular Expression To Match Two Words Separated By Comma Not Working?

Mar 4, 2010

I am pretty good with perl regular expressions but evidently I am at a loss on why this doesn't work.The code below stores "Person Test" in output variable.

im output As String
Dim userName As String = "Test, Person"
Dim re As New Regex("(w+),s(w+)", RegexOptions.Singleline)
output = re.Replace(userName, "$2 $1")

So why doesn't the following code store "#Test##Person#" in output variable.

Dim output As String
Dim userName As String = "Test, Person"
Dim re As New Regex("(w+),s(w+)")
For Each Match As Match In re.Matches(userName)
output &= "#" & Match.ToString & "#"
Next

View 2 Replies

UnhandledExceptionEventHandler Samples From Msdn Working, In My Code Not Working?

Sep 3, 2009

I found on msdn samples and modified (add Thread.GetDomaind.UnhandledException)

<SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.ControlAppDomain)> _
Public Sub Main()
' Add the event handler for handling UI thread exceptions to the event.[code].....

View 1 Replies

Code Reapet The First Regex Condition?

Aug 14, 2011

wrote a program with Regex condition but it shows me Twice the first condition (<H1>Welcome to my Homepage</H1>)what is my problem?i enable multiline property of Textbox1

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim l As New Regex("<(H1|H2)>.*?</(H1|H2)>")

[code].....

View 2 Replies

RegEx - Finding / Returning A Code

Jul 10, 2009

I must admit it's been a few years since my RegEx class and since then, I have done little with them. So I turn to the brain power of SO. . . I have an Excel spreadsheet (2007) with some data. I want to search one of the columns for a pattern (here's the RegEx part). When I find a match I want to copy a portion of the found match to another column in the same row.

[Code]...

View 3 Replies

RegEX Style For HTML Code?

Apr 4, 2011

what would the regEX code be for the following:

<br/><span class=""synopsis-view-synopsis"">America's justice system comes under indictment in director <a href='/people/1035' class='actor' style='font-weight:bold'>Norman Jewison</a>'s trenchant film starring <a href='/people/1028'

[code].....

View 3 Replies

Forms :: TextChanged Code And Button Click Code Not Working?

Jul 2, 2009

I have made an application in VB.NET.The Button click codes are working fine. I have made a small modification in the code. I have commented the line 'Me.Close'But still my form gets closed. I think the application is executing from elsewhere.

View 8 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.Replace - 3 Lines Of Code Be Condensed To 1 Line?

Jan 13, 2010

Yes, I've googled. But I must defer to the experts as time to study Regex is not available.

[Code]...

Can these 3 lines be condensed into one line? If so, how? The purpose is to remove all spaces before and after all occurrences of & in a string.

View 3 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

Regex: Take Text & Some Special Characters Between The Xml Tags Using Regex On C#.net?

Feb 23, 2012

I want to take the text and some special characters between the xml tags.. My input file contains:

[Code]...

now i want the Regex to take text and the special characters between the tags <line>,<inline>..

View 2 Replies

Increment Regex Match Using Regex.Replace

Jun 21, 2012

I'm creating a program in VB.NET to output multiple images. Some images will have the same file name. If there is multiple files with the same name I want to add "_1_" to the end of the file name. If the "_1_" file already exists I want to increment the 1 to be "_2_". If this file already exists I want to continue incrementing the number ultil it doesn't exist. So for example "filename", filename_1_", "filename_2_", etc. Here is the code that I have tried

[Code]...

View 1 Replies

Regex Builder That Actually BUILDS RegEx From A Highlight

Nov 17, 2011

I've been working straight since yesterday trying to get this to work. I'm a noob to RegEx and I've tested out about 5 different RegEx "builders" but each of them require you to navigate through the options to build the Regex...each of them has failed when I try to use them.Is there an application out there free/paid where you select the line you want to grab and the RegEx is auto generated from that highlight rather than having to try to build the line of code? [code]

View 1 Replies

Code Is Not Working When Using Run As

Feb 27, 2012

One of the buttons in my application maps a network drive.The code for it works fine when I run the application normally, but when I do a RunAs with other credentials, it does nothing. [code]

View 6 Replies

Get HTML Code Not Working?

Apr 23, 2012

When i run this code to get results from yahoo or google it does not work and it says that that ids not there but it always is."Object reference not set to an instance of an object."

Public Class Form2
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles

[code].....

View 2 Replies

MDI Form - Code Not Working

Apr 21, 2011

My MDIparent (MDIParent2) has a specific form(Webtab) as it's MDIchild, Webtab has a webbrowser control inside but I can't use the following:

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
activemdichild.webbrowser1.goback
End Sub

View 3 Replies

VS 2008 Code Not Working?

Aug 17, 2008

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
If WebBrowser1.DocumentText.IndexOf("FAILED LOGIN") > -1 Then

[code]....

Now the number 40 shows up in the web broswer so why isnt the ELSE showing the message box saying Login OK and the others?

View 9 Replies

VS 2010 Code Is Not Working?

Jun 16, 2010

but i used this to check if its true

Dim returnValue As String = html
Label4.Text = html
If Label4.Text = "true" Then

[code].....

View 14 Replies

Html - VB Basic RegEx - Save Value From An Input Tag In HTML Source Code

Feb 16, 2011

I am trying save a value from an input tag in some HTML source code. The tag looks like so:

<input name="user_status" value="3" />

I have the page source in a variable (pageSourceCode), and need to work out some regex to get the value (3 in this example). I have this so far: [Code] Which works fine most of the time, however this code is used to process source code from multiple sites (that use the same platform), and sometimes there are other attributes included in the input tag, or they are in a different order, eg:

<input class="someclass" type="hidden" value="3" name="user_status" />

I just dont understand regex enough to cope with these situations.

View 2 Replies

Edit The Current Regex Code To Include <script Type="text/javascript"?

Nov 16, 2011

Here is the current regex

"src=[""'](http://|./|/)?w+(.w+)*(/w+(.w+)?)*(/|?w*=w*(&w*=w*)*)?[""']>"

What I am trying to do is to grab element that is:

<script type="text/javascript" src="http://www.mysite="I need to grab everything inside these quotes">

With the current Regex I am able to grab the value but it also grabs all the "src" elements on the page.

src="http://www.mysite="I need to grab everything inside these quotes">

What I am attempting to do is to only get this one line that includes the

<script and then the src="">

And then just get the src="info from hrere" How can I edit the current regex code to include <script type="text/javascript"

View 1 Replies

C# - .Net String Parsing Library Or Regex For Parsing .Net Code Files

Mar 5, 2009

I would like to be able to parse vb.net code files, so I can examine the collection of Subs, Functions (and their contents, including comments), private variables, etc. I can be open the actual source code files. So for example, if I have:

[Code]....

View 7 Replies

CODE - Subtotal - Not Working For The Total At The End

Jul 1, 2009

This is what I have, but its not working for the total at the end..the IF bit at the subtotal...

Description
Qty
Unit Price
Total
FORMTEXT

[CODE]...

View 4 Replies

Code For Camera Not Working Properly

Jun 29, 2011

I got the following code from net,its working sometimes but sometimes not working, why?Its not showing the video by every click of the button Preview.I want some better code which will work smoothly and will show the video by every click. [code]

View 4 Replies

Code To Use Enter To Search Not Working

Dec 29, 2011

i am trying to make it so that when you are typing a url into the url box on my web browser, you can click enter to search like on comercial browsers instead of having to click the actual search button, im trying to do the same with the web search(google, bing, yahoo!). it worked before, but i've added a tab system to the browser and now it's not letting me click enter to search.

my code:

Private Sub urlgo_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles urlgo.KeyDown
If e.KeyData = Keys.Return Then
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(urlsearch.Text)

[code].....

View 1 Replies

Code Working If Use Web User Control Of Asp.net?

Jan 27, 2011

How to use this code working if i use web user control of asp.net ?

[Code]...

View 2 Replies

Email Code Not Working For My 2 Computers?

Jun 11, 2012

[code]OK here is the problem, it does not send the email on any of my 2 computers. No firewall, No Anti Virus. I don't know if there is an error in this or what? All the other code works fine, except for this emailing part.

View 4 Replies







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