Edit first pipe in every line of a dump file.

Gonzalo
2012-04-01
2012-12-29
  • Gonzalo

    Gonzalo - 2012-04-01

    Hello everyone, i got here searching for help with notepad++.

    I have a dump file pipe delimited with several rows and several fields per row delimited by the pipe symbol.
    It looks like this:

    some text|more text|yet more text| and more text

    What i need to accomplish is replacing just the FIRST pipe in every row with the word "in", so the result would look like this:

    some text in more text|yet more text|and more text

    What would be the regular expression to make this happen?

    Thanks in advance, i've been searching for this everywhere and can't find a way…

     
  • Dave Brotherstone

    Search:  ^(+)\|
    Replace: \1 in

    There's a space after the "in", assuming you want a space.  If you've not upgraded to N++ 6.0 yet, you might not need the last backslash.

    Cheers,
    Dave.

     
  • Gonzalo

    Gonzalo - 2012-04-01

    Yup Dave, it worked like a charm.

    Thanks a lot man, i really appreciate it!

     
  • Gonzalo

    Gonzalo - 2012-12-21

    For some reason this is not working anymore.

    I edited thousands of files with this method:

    Search: ^(+)\|
    Replace: \1 in

    But today it doesn't find the first pipe anymore...

    Anyone can help me with this?

     
    Last edit: Gonzalo 2012-12-21
    • Dave Brotherstone

      ERROR! The markdown supplied could not be parsed correctly. Did you forget to surround a code snippet with "~~~~"?

      Your regex is invalid. It should be
      
      ^(.+)\|
      
      Dave
      On 21 Dec 2012 22:04, "Gonzalo" <grangonzo@users.sf.net> wrote:
      
      > For some reason this is not working anymore.
      >
      > I edited thousands of files with this method:
      >
      > Search:  ^(+)\|
      > Replace: \1 in
      >
      > But today it doen't find the first pipe anymore...
      >
      > Anyone can help me with this?
      > ---
      > [Edit first pipe in every line of a dump file.](
      > https://sourceforge.net/p/notepad-plus/discussion/331754/thread/5f3f9f34/?limit=25#4034
      > )
      >
      > ---
      >
      > Sent from sourceforge.net because you indicated interest in <
      > https://sourceforge.net/p/notepad-plus/discussion/331754/>
      >
      > To unsubscribe from further messages, please visit <
      > https://sourceforge.net/auth/prefs/>
      >
      
       
      • Gonzalo

        Gonzalo - 2012-12-22

        Hi again Dave.

        This regex: ^(.+)\| sends me to the last pipe instead of the first.
        How do i get to the first one?

         
  • cchris

    cchris - 2012-12-29
    ^([^|]*)\| should work.
    Or even ^(.+?)\|
    

    CChris

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks