Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


group regex and replace

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,55086
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> group regex and replace
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 group regex and replace - 1/8/2008 1:23:19 AM   
  Zath

 

Posts: 2
Score: 0
Joined: 1/8/2008
Status: offline
Ok, asp classic site.

I have a page/doc description.

Now, one of the descriptions has a very very long string in it something like:
The is the description of adfaslkdfhasdfasdhfaadgjadfgjadgjasf

Well, it's much longer though.  A bad doc I guess but there could be more.

So, need to take this description, test it and maybe remove it or replace with "".
Been trying to look into group regex for length of 70 and replace that string group with ""

I've gotten this far and just can't seem to find the solution to this:

Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = ".{80,}"
.IgnoreCase = True
.Global = True
End With

'expressionmatch = RegularExpressionObject.Test(desc)
Set expressionmatch = RegularExpressionObject.Execute(desc)

If expressionmatch Then
'desc = "test"
End If


This needs to be adjusted to if in desc, the string to search, replace any work longer than 80 with empty string or "".

Any suggestions out there?

Thanks,

Zath
 
 
Post #: 1
 
 RE: group regex and replace - 1/8/2008 2:13:17 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Here is an example:


Option Explicit
Dim oRE : Set oRE = New Regexp
Dim strTest
strTest = "This is the first bit. Thisisareallylongstringabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz This is the last bit of text."
oRE.Pattern = "\w{80,}"
WScript.Echo oRE.Replace(strTest, "")

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Zath)
 
 
Post #: 2
 
 RE: group regex and replace - 1/8/2008 2:23:09 AM   
  Zath

 

Posts: 2
Score: 0
Joined: 1/8/2008
Status: offline
I have been banging my head on this one for a while.

You are an absolute life saver!

Thanks!!!!!!


Zath

(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> group regex and replace Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts