Inverse searching Regular Expression problem

Inverse searching Regular Expression problem

2
NewbieNewbie
2

    Aug 08, 2007#1

    Hi,
    I have a problem in Regular Expression.

    File 1 is:
    ABCgg003D

    if I want to search with any text start with BC and the end is 003 in File 1. I use BC*003 in find function. That work fine. Found 1 result.

    File 2 is:
    ABCgg002D

    if i want text start with BC but not end with 003 in File 2. I have try BC*~^{003^}. I suppose 1 will be found. But the result is 0.

    What Regular Expression should i use?
    THX:)

    6,675585
    Grand MasterGrand Master
    6,675585

      Aug 08, 2007#2

      First read the sticky forum topic in this forum. Then tell us your version of UE/UES and which regex engine you use.

      Usually it is not possible to search "if a string is not at ...". With the UltraEdit and the Unix engine it is definitely not possible what you want. Only possible is "next character is not a or b or c or ..." by using [~abc] in UltraEdit syntax or [^abc] in Unix syntax.

      If BC*~^{003^} should be an UltraEdit regex search string, than this is a completely invalid one and so does never find something.
      Best regards from an UC/UE/UES for Windows user from Austria

      236
      MasterMaster
      236

        Aug 08, 2007#3

        If you have an UE version >12, you can use the Perl regex engine that features negative lookahead.

        Code: Select all

        BC(?:(?!003).)*$
        will find "BC" followed by anything except 003 until the end of line.

        I.e., ABCgg003D won't match, ABCgg002d will match BCgg002d.

        HTH,
        Tim

        2
        NewbieNewbie
        2

          Aug 09, 2007#4

          Thanks for replies!

          My UltraEdit version is 13.10a+1.

          I have tried

          Code: Select all

          BC(?:(?!003).)*$
          , but the result still is 0 in File 2 (BCgg002d). Should I configure something before use Perl regex engine?

          236
          MasterMaster
          236

            Aug 09, 2007#5

            Did you read the sticky, esp. section 2?

            And of course, did you check "Regular Expressions" in the Find dialog?