473,604 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Text.Reg ularExpressions Class

Using regular expression testers such as Expresso or Dan Appleman's tester,
I have a regular expression that tests fine and is returning matches.
However, when the same regex is run through code, the same code that is
returning the matches in the tester, no matches are found. The only
difference is that the in the tester, the source to run the regex against
are placed into a texbox (string array) and in the code the source is
generated from a web request into a string object.

Has anyone had any similar issues?

Thanks
Chris
Nov 19 '05 #1
2 2547
Hello,

"chris fink" <ch********@dec isionone.com> schrieb:
I have a regular expression that tests fine and is returning matches.
However, when the same regex is run through code, the same code that is returning the matches in the tester, no matches are found. The only
difference is that the in the tester, the source to run the regex against are placed into a texbox (string array) and in the code the source is
generated from a web request into a string object.


Post some code.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 19 '05 #2
Hello Herfried,

I'm having the same problem and it's driving me crazy. This code does
not work when run but works in 2 expression evaluators.

Chris

Sub test()
Dim testString As String = "Me.Button1.Nam e = 'Button1'"
Dim regVars As New Regex( _
"(?:^\s*)(?<nam e>.*)\s*=\s*(?< value>.*)(?=\r\ n)", _
RegexOptions.Ig noreCase _
Or RegexOptions.Mu ltiline _
Or RegexOptions.Co mpiled _
)
Dim regMC As MatchCollection = regVars.Matches (testString)
If regMC.Count > 0 Then
MsgBox("Success ")
End If
End Sub
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1269
by: Juan | last post by:
Hi, I´m using System.Text.RegularExpressions, I want to find any acurrence of the char & or % or | Ehat is the correct sintax for the Match method? This is what I´m usinf but is not working: Match myMatch = Regex.Match(myString,"^*$"); Thanks, Juan.
2
6622
by: Doug | last post by:
I'm a little confused by this functionality. It doesn't seem to be behaving like it should. I am using the following regular expression to validate email addresses: "\w+(\w+)*@\w+(\w+)*\.({2,4})\040*". From what I can determine it should validate the following rules: 1. BEFORE THE AMPERSAND A. Must contain at least one alphanumeric character.
8
7825
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's in the namespace "System.Text.RegularExpressions;" and that namespace is, in turn, defined in the namespace "System", according to MSDN at http://msdn2.microsoft.com/en-us/library/c75he57e(en-us,VS.80).aspx. So adding "using...
0
1329
by: Neo The One | last post by:
I find some of the Regex classes are quite helpful for my learning. For example: System.Web.RegularExpressions.SimpleDirectiveRege <%\s*@(\s*(?<attrname>\w+(?=\W))(\s*(?<equal>=)\s*"(?<attrval>*)"|\s*(?<equ l>=)\s*'(?<attrval>*)'|\s*(?<equal>=)\s*(?<attrval>*)|(?<equal>)(?<at trval>\s*?)))*\s*?%> would match the following lines in my test aspx page: <%@ Page Language="C#" Debug="True" %> <%@ Import Namespace="System.IO" %>
0
999
by: Vikram | last post by:
I am using regex class in codebehind to validate some control's text. But for checking , postback is done.I want to avoid postback and check the same exprseeion using regularexpressionvalidator. I have used same expression strin in validator as it was in regexp class.but it is not working fine. do it need to do some converiosn ?
0
4344
by: Jim Duffie | last post by:
Hi, I am trying to build a simple websire using the above in Visual Web Developer. When finished I have build the website and it works fine locally but when I FTP it to the server I am getting a parse error. Should I be uploading a DLL as well (I can't see one in directory)? The error is :- Parser Error Message: Could not load type System.Web.UI.WebControls.Menu from assembly System.Web, Version=1.0.5000.0, Culture=neutral,...
2
20820
by: AnalogKid17 | last post by:
Keywords: ASP.NET app with VS2005 running on Win2003 with IIS6, and SQL2000 on a WinXP Box I've betting the following for days... it's driving me insane: Server Error in '/' Application. Security Exception Description: The application attempted to perform an operation not
9
2182
by: Arpan | last post by:
If I am not wrong, System.IO is one of the seven namespaces that get imported in all ASP.NET page automatically but in the following code: <%@ Import Namespace="System.IO" %> <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Dim ioFileInfo As New FileInfo("C:\Inetpub\wwwroot\File1.asp") lblOutput.Text = "Name: " & ioFileInfo.Name & "<br>" lblOutput.Text += "Path: " & ioFileInfo.DirectoryName & "<br>"
3
4000
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user selects? thanks...
9
13330
by: garyusenet | last post by:
I am using a C# solution that somebody kindly sent me. It was a console application. I am trying to get use of the MessageBox. I have added the following using directive to the namespaces at the start of the program : - using System; // I've added this...
0
7997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7929
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8280
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5882
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1526
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.