group regex and replace

Author Message
Zath

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 1/8/2008
  • Status: offline
group regex and replace Tuesday, January 08, 2008 2:23 AM (permalink)
0
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
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: group regex and replace Tuesday, January 08, 2008 3:13 AM (permalink)
    0
    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
     
    #2
      Zath

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 1/8/2008
      • Status: offline
      RE: group regex and replace Tuesday, January 08, 2008 3:23 AM (permalink)
      0
      I have been banging my head on this one for a while.
       
      You are an absolute life saver!
       
      Thanks!!!!!!
       
       
      Zath
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • 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
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9