Tapatalk

Find "Not Beginning With"?

Find "Not Beginning With"?

211
Basic UserBasic User
211

    Sep 22, 2006#1

    I have a file in plain text format that contains paths, one per line, such as:
    c:\asdf
    c:\asdf\qwerty
    c:\Windows
    etc...

    I'm trying to find a way to search this file for any line that does NOT start with "c:\"

    Any ideas?

    Thanks

    6,685587
    Grand MasterGrand Master
    6,685587

      Re: Find "Not Beginning With"?

      Sep 23, 2006#2

      Similar to Delete all lines not starting with a special phrase with the only difference that you don't want to delete those lines.

      As already written in the thread linked above and several times in other threads a search for NOT("Beginning/Starting With") is in general not possible.

      But in your special situation it is possible with following Perl regular expression: ^([^c]|c[^:]|c:[^\\]).*$

      Note: This regex works only with the Perl compatible regular expression engine. The legacy Unix and the UltraEdit engine can only have 2 arguments in an OR expression, but here 3 arguments are necessary.

      Code: Select all

      ^ ......... start of a line
      (x|y|z) ... OR expression with 3 arguments
      [^c] ...... first OR argument matches all lines not starting with character 'c'.
      c[^:] ..... second OR argument matches all lines starting with character 'c'
                  but second character is not a ':'.
      c:[^\\] ... third OR argument matches all lines starting with "c:"
                  but third character is not a '\'.
      .*$ ....... matches the rest of the line without the line termination
                  characters (CRLF for DOS).
      Best regards from an UC/UE/UES for Windows user from Austria

      211
      Basic UserBasic User
      211

        Sep 30, 2006#3

        Mofi,

        Thanks for the reply, but this does not seem to work in UltraEdit 12. Evidently, I wasn't specific enough in my question. I was looking for a way to do this search (for lines not starting with c:\ within UltraEdit. I bring the file up in the editor, then use the Find function.

        Thanks again,
        John

        6,685587
        Grand MasterGrand Master
        6,685587

          Oct 01, 2006#4

          The regular expression I posted works with UltraEdit v12.10b and only with v12.00 and above because the Perl compatible regular expression must be used. I think, you have not specified this regular expression engine at Advanced - Configuration - Search - Regular Expression Engine. That's the reason why it does not work.
          Best regards from an UC/UE/UES for Windows user from Austria

          211
          Basic UserBasic User
          211

            Oct 02, 2006#5

            Mofi,

            I had already set the configuration option. The problem was that I was not checking the "Regular Expressions" box in the find dialog. I did that, and the search worked perfectly.

            Thanks again!!!!!!!!!!!!!!!!