Loading ...
Sorry, an error occurred while loading the content.

4676Re: Search and replace with match

Expand Messages
  • ssalter2006
    Jun 14, 2006
    • 0 Attachment
      Thank you all very much!!


      --- In editplus@yahoogroups.com, "" <dz@...> wrote:
      >
      >
      >
      > ----- Original Message -----
      > From: ssalter2006
      > Sent: 6/13/2006 10:43:46 AM
      > To: editplus@yahoogroups.com
      > Subject: [edit+] Search and replace with match
      >
      > > I've got groups of radio buttons named like this:
      > >
      > > <td><input type=radio name=rad1 value=4></td>
      > > <td><input type=radio name=rad1 value=3></td>
      > > <td><input type=radio name=rad1 value=2></td>
      > > <td><input type=radio name=rad1 value=1></td>
      > >
      > > Goes from rad1 to rad45 groups.
      > >
      > > and I'd like to change the "rad" to "Question" but keep the
      number, ie:
      > > rad1 group turns into Question1 group.
      > >
      > > I can match the "rad" with this: name=rad*[0-9] but how do I
      do a
      > > replace that keeps the radio button group number?
      >
      > Use parentheses to group the matches:
      >
      > Find: (name=)rad([0-9]+)
      > Replace: \1Question\2
      >
      > That will hold the first grouped match in \1 and the second one in
      \2, and replaces it with the first match, followed by the
      string "Question, followed by the second match; so that "name=rad1",
      say, turns into "name=Question1".
      >
      > P.S. The '*' symbol goes on the right of the digit range to signify
      0 or more digits. As you put it, it means "0 or more 'd's", so it
      will match "rad1", "ra3", and "raddddddd3".
      >
      > -dZ.
      >
    • Show all 4 messages in this topic