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. Regular Expressions
  4. Ignoring repeating values?

Ignoring repeating values?

Scheduled Pinned Locked Moved Regular Expressions
sysadminregexquestion
4 Posts 3 Posters 9 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.
  • J Offline
    J Offline
    Jason Hotchkiss 2021
    wrote on last edited by
    #1

    Hello - I have the following string: [ CmdAV=show CmdArgAV=policy-map CmdArgAV=system CmdArgAV=type CmdArgAV=network-qos CmdArgAV= ] Is it possible to use regex to leave only: show policy-map system type network-qos I don't need the [,], or CmdAV or CmdArgAV.

    W 1 Reply Last reply
    0
    • J Jason Hotchkiss 2021

      Hello - I have the following string: [ CmdAV=show CmdArgAV=policy-map CmdArgAV=system CmdArgAV=type CmdArgAV=network-qos CmdArgAV= ] Is it possible to use regex to leave only: show policy-map system type network-qos I don't need the [,], or CmdAV or CmdArgAV.

      W Offline
      W Offline
      w 3g
      wrote on last edited by
      #2

      This should do the trick:

      /C\w+=|[[\]]/g

      J 1 Reply Last reply
      0
      • W w 3g

        This should do the trick:

        /C\w+=|[[\]]/g

        J Offline
        J Offline
        Jason Hotchkiss 2021
        wrote on last edited by
        #3

        Great, this does work. Thank you! Is it possible to capture the remained words into a single group?

        J 1 Reply Last reply
        0
        • J Jason Hotchkiss 2021

          Great, this does work. Thank you! Is it possible to capture the remained words into a single group?

          J Offline
          J Offline
          jsc42
          wrote on last edited by
          #4

          Jason Hotchkiss 2021 wrote:

          Is it possible to capture the remained words into a single group?

          How about

          /(C\w+=|[[\]])/g

          ?

          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