Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2006, 12:34 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regular Expression Error

I'm trying to use regular expressions in my ASP.NET doc, and I'm running into a problem. This is how I've set it up:
Code:
<%@ import Namespace="System.Text.RegularExpressions" %>
<%
'Validate form data - required fields only
Dim RegularExpressionObject As Object

RegularExpressionObject = New RegExp

    With RegularExpressionObject
    .Pattern = "[A-Za-z0-9]"
    .IgnoreCase = True
    .Global = True
End With
%>
And this is the error that I'm receiving:
Compilation Error
Type 'RegExp' is not defined.

Line 77: Dim RegularExpressionObject As Object
Line 78:
Line 79: RegularExpressionObject = New RegExp
Line 80:
Line 81: With RegularExpressionObject

If anyone can give me some advice on my I'm getting this error message, it would be greatly appreciated. Thanks.

KWilliams

KWilliams
 
Old February 16th, 2006, 02:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

ASP.NET? That is the ASP approach, in ASP.NET, you put your code in the <script runat="server"></script> tags. You have the right namespace, but I believe it is Regex now. Match still exists.

Brian
 
Old February 16th, 2006, 04:06 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:ASP.NET? That is the ASP approach, in ASP.NET, you put your code in the <script runat="server"></script> tags. You have the right namespace, but I believe it is Regex now. Match still exists.
I'm actually using XML & XSL transformed using ASP.NET, and then I use background ASP.NET/VB scripts wherever needed. This specific script performs server-side tasks...not client-side for the form.

I've already set up the rest of this form with no problems using this setup. The only problem I'm having is with Regular Expressions. If I'm declaring the Regular Expression's namespace at the very beginning of the ASP.NET doc, and then trying to call the "New RegExp" method, why would I then receive this error message? Thanks for any help.

KWilliams
 
Old February 16th, 2006, 04:49 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I looked further into 4guysfromrolla's articles on ASP.NET Regular Expressions, and I found a good one at http://aspnet.4guysfromrolla.com/articles/022603-1.aspx. It had a method that works like this:

Dim test_value As String = "+" '(plus sign)
If Regex.IsMatch(fname_form, "^+") Then
Response.Write(errormessage)
End If
...and it works. I now just have to work with what characters I will allow for each field.

Thanks again for your help. I really appreciate it.

KWilliams





Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression Help pallone Javascript 2 October 19th, 2007 03:59 PM
regular expression MunishBhatia ASP.NET 2.0 Professional 5 May 22nd, 2007 07:59 AM
Unknown Modifier Error - Regular Expression Beebs BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 March 20th, 2007 05:48 PM
regular expression vohra_vikas2004 ADO.NET 3 November 18th, 2004 09:59 PM
Regular Expression Help Greg Griffiths Javascript How-To 4 November 12th, 2004 05:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.