Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

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

    Help wanted · · · – – – · · ·
    4
    10
    1314
    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.
    • jesus ul
      jesus ul last edited by

      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.

      Alan Kilborn astrosofista 2 Replies Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @jesus ul last edited by

        @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

        jesus ul 1 Reply Last reply Reply Quote 0
        • astrosofista
          astrosofista @jesus ul last edited by

          @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.

          jesus ul 1 Reply Last reply Reply Quote 0
          • jesus ul
            jesus ul @astrosofista last edited by

            @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
            • jesus ul
              jesus ul @Alan Kilborn last edited by

              @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

              Paul Wormer Alan Kilborn 2 Replies Last reply Reply Quote 0
              • Paul Wormer
                Paul Wormer @jesus ul last edited by

                @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.

                jesus ul 2 Replies Last reply Reply Quote 0
                • jesus ul
                  jesus ul @Paul Wormer last edited by

                  @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
                  • jesus ul
                    jesus ul @Paul Wormer last edited by

                    @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
                    • Alan Kilborn
                      Alan Kilborn @jesus ul last edited by

                      @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. :-(

                      jesus ul 1 Reply Last reply Reply Quote 0
                      • jesus ul
                        jesus ul @Alan Kilborn last edited by

                        @alan-kilborn thank you very much

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright © 2014 NodeBB Forums | Contributors