Tapatalk

Find all characters between " " quotes

Find all characters between " " quotes

1
NewbieNewbie
1

    Mar 14, 2008#1

    I have a large ascii file with characters delimited with quotes( " " ). However there are CRs between the beginning quote and the ending quote. I have tried using the UE find "[~)]+" but it didn't work. I'm brand new to UE so any suggestions would help.

    236
    MasterMaster
    236

      Mar 14, 2008#2

      Please read the forum readme topic. Mofi has compiled a wealth of information about find/replace operations there.

      Assuming (since you say you're brand new to UE) that you have UE V14, do the following: Click on the Advanced button in the search dialog and choose "Perl" as your regex engine. Then check the "Regular expressions" checkbox.

      Search for

      Code: Select all

      "[^ÿ]*?"
      Explanation: Match a ", then match any character(s) that are not a ÿ (assuming that this character will never turn up in your files), then match another ". The * means "match zero or more times", the ? makes the * a "lazy quantifier" meaning "match as few characters as possible that still allow the overall regex to match. If you dropped the ? it would match from the very first " all the way to the very last " in your entire file.

      HTH,
      Tim

      22
      Basic UserBasic User
      22

        Mar 20, 2008#3

        Tim,
        I'm puzzled about your use of ÿ in the negated character set. Why couldn't you just use a negated quote:
        i.e. "[^"]*?"
        Using your lazy quantifier it would single step from the first quote until it hit the second one. Maybe I'm missing something here?

        Cordially,
        jane

        236
        MasterMaster
        236

          Mar 20, 2008#4

          You're absolutely right, of course! <duh!>

          I'm so used to this ÿ-trick to overcome the lack of a "dot matches newline" option that I overlooked the best solution. You don't even need the ? anymore. "[^"]*" should be enough.

          Cheers,
          Tim