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 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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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.
|
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.
|
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...
|
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" %>
|
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 ?
| |
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,...
|
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
|
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>"
|
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...
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |