Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional 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 December 7th, 2006, 04:36 AM
Registered User
 
Join Date: Dec 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP Regex problem

I'm experiencing a rather strange issue when i try to use the Regexp object in an ASP script; maybe i'm missing something. basically, i have a script which reads in the contents of a text file, looks for this string pattern ".*" and replaces it with the new employee name like this:
NEW-EMPNAME. here's the code
'===========================================
Dim REObj
Set REObj = New RegExp

With REObj
  .Pattern = ".*"
  .IgnoreCase = true
  .Global = false
End With

strdata = REObj.Replace(strdata,"" & strnewemployee & "")

'===========================================
problem is, if the new emp name is something like "empname 2", the final output is coming out as "empname 2 2" (see the duplicate 2 at the end)

if the original data is "empname 2 2", then the script returns "empname 2 2 2". I cant quite see where the problem is. any help would be greatly appreciated






Similar Threads
Thread Thread Starter Forum Replies Last Post
regex mrame XSLT 12 July 25th, 2008 09:37 AM
ASP Regex problem cajedi Classic ASP Basics 0 December 7th, 2006 04:35 AM
REGEX Problem - Excel Hangs sreins VB How-To 0 December 5th, 2006 05:44 PM
Regex htran XSLT 2 May 18th, 2005 09:21 AM
Regex Problem claudew BOOK: ASP.NET Website Programming Problem-Design-Solution 2 June 5th, 2004 07:55 PM





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