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

6959Re: [edit+] I need help to replace

Expand Messages
  • DZ-Jay
    Aug 27, 2012
    • 0 Attachment
      Great! Just keep in mind something: that expression means "match any two strings separated by spaces." It doesn't consider whether they are letters or numbers or symbols. It may have worked in your particular case, but it is always a good idea to be as narrow as possible in matching.

      Also, the parenthesis are used to "group" matches you want to use later. In your case, you are only interested in the second part of the match, so you do not need the (.*) at the beginning, just the dot-star. The replace string then changes to "\1" to represent the first group.

      Cheers!
      dZ.

      On Aug 27, 2012, at 09:51, Live Queens wrote:

      > fixed it
      > worked with
      > find what (.*) +(.*)
      > replace with: \2
      >
      >
      >
      > ________________________________
      > From: DZ-Jay <dz@...>
      > To: editplus@yahoogroups.com
      > Sent: Monday, August 27, 2012 3:19 PM
      > Subject: Re: [edit+] I need help to replace
      >
      >
      >
      > Ok, that's different. So, if I understand correctly, what you have is:
      >
      > 1. A list of username records, one per line
      > 2. Each one prefixed by a number, followed by whitespace
      > 3. The usernames can contain mixed-case letters and numbers
      > 4. You want to remove the numeric prefix and whitespace
      >
      > If the above is correct, then you can try the following:
      >
      > Find: ^[0-9]+ +([a-zA-Z0-9]+)
      > Replace: \1
      >
      > That should work with the example you posted.
      >
      > Notice that the "^" symbol means "match at the beginning of the line." If the username records to not start at the beginning of the line, you can remove that. However, it will cause it to match *anything* that fits that pattern within the line, as many times as it matches.
      >
      > dZ.
      >
      > On Aug 26, 2012, at 20:53, Live Queens wrote:
      >
      >> Doug, i don't have nickname
      >>
      >> nickname are usernames
      >>
      >> like Joana22 Diana32 ..etc
      >>
      >> so the list looks like this
      >>
      >> 1 A00Diana
      >> 2 A0001Ioana16
      >> 3 A1Iuliana
      >> ...
      >> 345256 Z0Andreas23
      >>
      >> And I have to cut off the numbers that are in front of usernames
      >>
      >> and to have an output like this
      >>
      >> A00Diana
      >> A0001Ioana16
      >> A1Iuliana
      >> ...
      >> Z0Andreas23
      >>
      >>
      >>
      >>
      >>
      >>
      >> ________________________________
      >> From: Doug Fortnam <dfortnam@...>
      >> To: editplus@yahoogroups.com
      >> Sent: Monday, August 27, 2012 3:49 AM
      >> Subject: RE: [edit+] I need help to replace
      >>
      >>
      >>
      >> I was playing around with this and could not get dZ's solution to work, but
      >> this worked:
      >>
      >> Find: (.*)[0-9] +(nickname[0-9]+)
      >> Replace: \2
      >>
      >> Doug
      >>
      >> -----Original Message-----
      >> From: editplus@yahoogroups.com [mailto:editplus@yahoogroups.com] On Behalf
      >> Of DZ-Jay
      >> Sent: Sunday, August 26, 2012 8:18 PM
      >> To: editplus@yahoogroups.com
      >> Subject: Re: [edit+] I need help to replace
      >>
      >> Hello:
      >>
      >> You can try something like this (without the quotation marks):
      >>
      >> Find: "[0-9]+(nickname[0-9]+)"
      >> Replace: "\1"
      >>
      >> dZ.
      >>
      >> On Aug 26, 2012, at 17:35, LiveQueens wrote:
      >>
      >>> hello I need to replace
      >>>
      >>> 1 nickname2
      >>> 2 nickname33
      >>> 3 nickname234
      >>> 4 nickname21
      >>> ..(365355 nickname54
      >>>
      >>> output
      >>>
      >>> nickname2
      >>> nickname33
      >>> nickname234
      >>> nickname21
      >>> nickname54
      >>>
      >>> what is the expression i need to use ?
      >>>
      >>> thank you
      >>>
      >>>
      >>
      >> ------------------------------------
      >>
      >> http://www.editplus.comYahoo! Groups Links
      >>
      >>
      >>
      >>
      >> [Non-text portions of this message have been removed]
      >>
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Show all 12 messages in this topic