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. General Programming
  3. Visual Studio
  4. using a regular expression replace string in VS 2003

using a regular expression replace string in VS 2003

Scheduled Pinned Locked Moved Visual Studio
visual-studioregexquestion
3 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.
  • H Offline
    H Offline
    hyling
    wrote on last edited by
    #1

    Hi, According to the documentation, in the "find & replace" dialog I should be able to use a regular expression as a replacement string if the "Use:" checkbox is enabled and "Regular Expressions" is selected. I'm trying to do the following: replace the first string with the second string: mName kName mValue kValue mDescription kDescription I'm using the following regular expressions in the find and replace fields: find what: "^m.+" replace with: "^k.+" Did I miss something? Thanks Hua-Ying -- modified at 15:20 Thursday 29th September, 2005

    S 1 Reply Last reply
    0
    • H hyling

      Hi, According to the documentation, in the "find & replace" dialog I should be able to use a regular expression as a replacement string if the "Use:" checkbox is enabled and "Regular Expressions" is selected. I'm trying to do the following: replace the first string with the second string: mName kName mValue kValue mDescription kDescription I'm using the following regular expressions in the find and replace fields: find what: "^m.+" replace with: "^k.+" Did I miss something? Thanks Hua-Ying -- modified at 15:20 Thursday 29th September, 2005

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Yeah - replace expressions are *NOT* regular expressions. They're effectively format strings. You want something like: find: {[^:a]}m{:i} replace: \1k\2 The find expression looks for a non-alpanumeric character before 'm' and hten an identifier pattern after the m and captures the non-alphanumeric character (in \1) and the identifier (in \2). The replace pattern outputs the concatenation of the first capture, k and the second capture. Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'

      H 1 Reply Last reply
      0
      • S Stuart Dootson

        Yeah - replace expressions are *NOT* regular expressions. They're effectively format strings. You want something like: find: {[^:a]}m{:i} replace: \1k\2 The find expression looks for a non-alpanumeric character before 'm' and hten an identifier pattern after the m and captures the non-alphanumeric character (in \1) and the identifier (in \2). The replace pattern outputs the concatenation of the first capture, k and the second capture. Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'

        H Offline
        H Offline
        hyling
        wrote on last edited by
        #3

        Oh I see, that's really cool! Thanks Hua-Ying

        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