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

Re: [NTB] Regular Expression Problem

Expand Messages
  • Tony Mc
    ... Hi Greg, sorry, I missed the bit about the name being enclosed in quotes, though the replacement above will enclose the email address in angle brackets
    Message 1 of 20 , Sep 30, 2007
    • 0 Attachment
      On Sat, 29 Sep 2007 22:50:39 +0100, you wrote:

      > HI Tony,
      > > Search for: ^(.*@.*)\t(.*?)(\(.*?\))\t(.*)$
      > > Replace with: $2 <$1>\t$3\t$4
      >
      > This suggestion seems not to tackle the main part of the problem -
      > getting the first field to wrap the newly inserted name in quotes and
      > the address in <>.
      >

      Hi Greg,

      sorry, I missed the bit about the name being enclosed in quotes,
      though the replacement above will enclose the email address in angle
      brackets (why do you think it doesn't?). So, to do the wrapping of the
      name, try this:

      Search for: ^(.*@.*)\t(.*?)\s+(\(.*?\))\t(.*)$
      Replace with: "$2" <$1>\t$3\t$4

      The search string is the same as before except that there is a \s+
      between the name and comment fields, which prevents white space from
      being included in the name field. Anyway, let me know if this does
      what you want.

      Best,
      Tony
    • Greg Chapman
      Hi Don, Apologies to you and all the others who responded for not getting back to you sooner. Other pressures mean I ve not been reading this list for a few
      Message 2 of 20 , Oct 4, 2007
      • 0 Attachment
        Hi Don,

        Apologies to you and all the others who responded for not getting back
        to you sooner. Other pressures mean I've not been reading this list
        for a few days.

        Thanks so much for this...

        On 29 Sep 07 23:00 "Don - HtmlFixIt.com" <don@...> said:
        >
        >
        >
        > ^([a-z|A-Z|0-9|.|_|\-]+?)@([a-z|A-Z|0-9|.|_|\-]+?)\.([a-z|A-Z|0-9|.|_|\-]{2,4})\t(.*?)\t(.*)
        >
        > missed just three of your examples you sent me directly and for
        > explainable reasons
        > should be 93 characters long

        Yes it certainly would have been a tall order to get it 100% right.

        Most of those who had a go for me (and thanks to all) concentrated too
        much on my attempt at a summary of the typical entry and didn't read
        all my accompanying notes, which did rather alter the problem.

        Checking back, I also realised that in one of my followups I provided
        a conflicting bit of information, so that didn't help.

        You didn't tell me what I should use as a replace string, so I used
        the original one, but that left me with a trailing $6 on the end of
        each entry, so I deleted that and tried again. Also the stuff in
        column three shifted into column two. However, that was easy to sort
        out with a regular search for a ^T and replace with ^T^T.

        After that it was just the three entries you mentioned and the handful
        of entries which by then had the (Comment) as part of the name. It
        certainly saved me a mass of time.

        Thanks again!

        Now I really must set aside some time to work out exactly how that all
        worked!

        Greg
      Your message has been successfully submitted and would be delivered to recipients shortly.