Community
    • Login

    Trim LDAP extract

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 3 Posters 2.6k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Online
              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 Offline
                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 Offline
                  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

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors