Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. replace web address with text friendly text

replace web address with text friendly text

Scheduled Pinned Locked Moved Web Development
comregexquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Garth
    wrote on last edited by
    #1

    I am looking for a way of removing instances of a web address/URL from an amount of text, where the URL is in the format Site Description and replacing/reformatting the text (for a text only newsletter) into a form like Site Description - www.something.com I am running WSH 5.0 - so some advanced regular expression features are out....any other ideas on how this could be achieved??

    Richard DeemingR 1 Reply Last reply
    0
    • G Garth

      I am looking for a way of removing instances of a web address/URL from an amount of text, where the URL is in the format Site Description and replacing/reformatting the text (for a text only newsletter) into a form like Site Description - www.something.com I am running WSH 5.0 - so some advanced regular expression features are out....any other ideas on how this could be achieved??

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      The RegExp object was added to VBScript in version 5, and to JavaScript in version 3. Just of the top of my head, you need something like:

      <a\s[^>]*?href=['"]([^'">]*?)['"][^>]*?>(.*?)</a>

      to be replaced with:

      $2 [$1]

      (with IgnoreCase = True, Global=True, MultiLine = False)

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups