Community
    • Login

    Trim LDAP extract

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 3 Posters 729 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Olivier ChantraineO
      Olivier Chantraine
      last edited by Olivier Chantraine

      Hello,
      i need to remove every first (ex:CN=toto), from my ldap export.
      its easy if there is only one.
      but my extract containt sometime more.

      ex:
      CN=toto,CN=test,DC=contoso,DC=local

      and then, the replace option remove every CN.
      If i use the mark option, its ok, but i can’t remove marqued texte (or i dont find the option)

      Could you help me with that ?
      Thanks :)

      Alan KilbornA Olivier ChantraineO 3 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Olivier Chantraine
        last edited by Alan Kilborn

        @Olivier-Chantraine

        Your problem statement is a bit vague, but with my interpretation of it, I would try:

        Find: \A(?s)(.*?)(?-i)CN=\w+,
        Replace: ${1}
        Search mode: Regular expression

        1 Reply Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn @Olivier Chantraine
          last edited by

          @Olivier-Chantraine said in Trim LDAP extract:

          i can’t remove marqued texte (or i dont find the option)

          This option doesn’t exist because you can just use Replace instead.

          1 Reply Last reply Reply Quote 1
          • Olivier ChantraineO
            Olivier Chantraine @Olivier Chantraine
            last edited by Olivier Chantraine

            @Olivier-Chantraine said in Trim LDAP extract:

            Hello,
            i need to remove every first (ex:CN=toto), from my ldap export.
            its easy if there is only one.
            but my extract containt sometime more.

            ex:
            CN=toto,CN=test,DC=contoso,DC=local

            and then, the replace option remove every CN.
            If i use the mark option, its ok, but i can’t remove marqued texte (or i dont find the option)

            Could you help me with that ?
            Thanks :)

            Sorry, i will try to be clear,
            i have a csv with multiple line (txt line)
            each line start with CN=
            CN=toto,CN=test,DC=contoso,DC=local
            CN=tota,OU=test,DC=contoso,DC=local
            CN=tata,OU=test2,DC=contoso,DC=local
            CN=tAto,CN=test2,DC=contoso,DC=local

            i want to remove the first “CN=text,”
            with option mark text, i use :

            ^CN.*?,
            

            and it work well (for marking only)
            but , if i replace, the regex erase all “CN=text,” in the same line

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @Olivier Chantraine
              last edited by PeterJones

              @Olivier-Chantraine said in Trim LDAP extract:

              and it work well (for marking only)
              but , if i replace, the regex erase all “CN=text,” in the same line

              That’s because after the substitution, the next CN=text, is the first CN=text, on the line, and it will match again.

              I think what you want is
              FIND = (?-s)^CN=.*?,(.*)$
              REPLACE = ${1}

              That will delete the first CN=..., on each line, leaving the rest of the line intact.

              ----

              Useful References

              • Please Read Before Posting
              • Template for Search/Replace Questions
              • Formatting Forum Posts
              • Notepad++ Online User Manual: Searching/Regex
              • FAQ: Where to find other regular expressions (regex) documentation
              Olivier ChantraineO 1 Reply Last reply Reply Quote 3
              • Alan KilbornA
                Alan Kilborn
                last edited by Alan Kilborn

                @Olivier-Chantraine

                From the revised explanation of the problem, I can see why you liked the Mark idea (that wouldn’t work). :-)

                1 Reply Last reply Reply Quote 2
                • Olivier ChantraineO
                  Olivier Chantraine @PeterJones
                  last edited by

                  @PeterJones said in Trim LDAP extract:

                  @Olivier-Chantraine said in Trim LDAP extract:

                  and it work well (for marking only)
                  but , if i replace, the regex erase all “CN=text,” in the same line

                  That’s because after the substitution, the next CN=text, is the first CN=text, on the line, and it will match again.

                  I think what you want is
                  FIND = (?-s)^CN=.*?,(.*)$
                  REPLACE = ${1}

                  That will delete the first CN=..., on each line, leaving the rest of the line intact.

                  ----

                  Useful References

                  • Please Read Before Posting
                  • Template for Search/Replace Questions
                  • Formatting Forum Posts
                  • Notepad++ Online User Manual: Searching/Regex
                  • FAQ: Where to find other regular expressions (regex) documentation

                  Ty, its working :)

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors