• Login
Community
  • Login

En cada linea, ¿cómo eliminar todo lo anterior a la aparición de la primera barra?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 4 Posters 9.1k 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.
  • J
    jesus ul
    last edited by Jan 8, 2022, 9:51 AM

    Hola,
    quisiera conseguir eliminar todo lo anterior a la aparición de la primera barra de cada línea, con la posibilidad de eliminar la barra o no eliminarla.
    P.ej: ¿cómo eliminar todo lo anterior a la aparición de la primera barra barra.jpg
    Agradeceria ayuda
    Disculpen si es una pregunta absurda, soy nuevo en esto.
    Gracias de antemano.

    A A 2 Replies Last reply Jan 8, 2022, 12:59 PM Reply Quote 0
    • A
      Alan Kilborn @jesus ul
      last edited by Jan 8, 2022, 12:59 PM

      @jesus-ul said in En cada linea, ¿cómo eliminar todo lo anterior a la aparición de la primera barra?:

      Hello,
      I would like to be able to eliminate everything prior to the appearance of the first bar of each line, with the possibility of eliminating the bar or not eliminating it.
      Eg: I would
      appreciate help.
      Sorry if this is an absurd question, I am new to this.
      Thanks in advance.

      In the future, please make postings in English as it is the preferred language of the Community.

      Try:

      find: (?-s)^.*?/\h*
      replace: nothing
      mode: regular expression

      J 1 Reply Last reply Jan 8, 2022, 5:04 PM Reply Quote 0
      • A
        astrosofista @jesus ul
        last edited by Jan 8, 2022, 1:32 PM

        @jesus-ul

        It’s a simple task for RegEx. Open the Replace dialog (Ctrl + H) and type:

        Search: (?-s)^([^/]*? / )(.+?)$
        Replace: $2
        

        Put the caret at the very beginning of the document, select the Regular Expression mode and click on Replace or Replace All.

        Now, if you want to preserve the first bar, try this other regex, following the above-mentioned instructions:

        Search: (?-s)^([^/]*? (?=/ ))(.+?)$
        Replace: $2
        

        Notes: Next time, please make postings in English —if inconvenient, translate it with a service like deepl.com . Also, please follow the template for search and replace questions.

        Traducción:

        Es una tarea sencilla para RegEx. Abre el cuadro de diálogo Reemplazar (Ctrl + H) y escribe:

        Buscar: (?-s)^([^/]*? / )(.+?)$
        Reemplazar con: $2
        

        Coloca el signo de intercalación al principio del documento, selecciona el modo “Expresión regular” y haz clic en “Reemplazar” o “Reemplazar todo”.

        Ahora bien, si quieres conservar la primera barra, prueba con este otra regex, siguiendo las instrucciones anteriores:

        Buscar: (?-s)^([^/]*? (?=/ ))(.+?)$
        Reemplazar con: $2
        

        Notas: Te recomiendo que en nuevas publicaciones escribas en inglés, que es el lenguaje de la comunidad -si esto te resulta inconveniente, tradúcelo con un servicio como deepl.com . También recomiendo que utilices la plantilla sobre búsquedas y reemplazos.

        J 1 Reply Last reply Jan 8, 2022, 3:18 PM Reply Quote 0
        • J
          jesus ul @astrosofista
          last edited by Jan 8, 2022, 3:18 PM

          @astrosofista Hello astrosofista,
          thanks for the answer, it’s just what I was looking for, and thanks for your recommendations. I’m new to this community and I don’t know the dynamics of this forum well yet, I’ll do my best.Thanks again.

          1 Reply Last reply Reply Quote 0
          • J
            jesus ul @Alan Kilborn
            last edited by Jan 8, 2022, 5:04 PM

            @alan-kilborn Hello ,
            thanks for the answer, but it is not what I was looking for.
            I will explain it more graphically:
            thanks again:¿cómo eliminar todo lo anterior a la aparición de la primera barra barra.jpg

            P A 2 Replies Last reply Jan 8, 2022, 5:26 PM Reply Quote 0
            • P
              Paul Wormer @jesus ul
              last edited by Jan 8, 2022, 5:26 PM

              @jesus-ul
              You probably did a “replace all”. The regexp is designed to go line for line. Place the caret (cursor) on top of your file and hit “Find Next”. You see a string marked from the start of the first line containing a bar up to the first bar (grey background). You may replace the marked string by “nothing”. If you then hit “Find Next” you will see the first string on the next line marked up to the first bar. You can replace this again by “nothing”, and so on to the end of file.

              J 2 Replies Last reply Jan 8, 2022, 5:45 PM Reply Quote 0
              • J
                jesus ul @Paul Wormer
                last edited by Jan 8, 2022, 5:45 PM

                @paul-wormer Gracias por la aclaración, es como tu dices,pero tengo ya la solución para reemplazarlo todo de golpe,solución que me la brindo muy amablemente un compañero tuyo,por tanto gracias a todos.

                1 Reply Last reply Reply Quote 0
                • J
                  jesus ul @Paul Wormer
                  last edited by Jan 8, 2022, 5:46 PM

                  @paul-wormer Thanks for the clarification, it is as you say, but I already have the solution to replace it all at once, a solution very kindly provided by a colleague of yours, so thanks to all of you.

                  1 Reply Last reply Reply Quote 0
                  • A
                    Alan Kilborn @jesus ul
                    last edited by Jan 8, 2022, 9:40 PM

                    @jesus-ul said in En cada linea, ¿cómo eliminar todo lo anterior a la aparición de la primera barra?:

                    thanks for the answer, but it is not what I was looking for.

                    Ah, my answer fell victim to the “where does the next search start” problem in Notepad++. Most editors would do it with my expression and give you what you wanted. :-(

                    J 1 Reply Last reply Jan 13, 2022, 6:42 PM Reply Quote 0
                    • J
                      jesus ul @Alan Kilborn
                      last edited by Jan 13, 2022, 6:42 PM

                      @alan-kilborn thank you very much

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