How to remove middle text?

  • Hi, @sarah-duong,

    You said:

    Why do I have to study ?

    Well, I would say, as a joke, to become more intelligent and, more seriously, to make your work easier and more autonomous !

    I really do not understand why you don’t want to invest a few days of your life to learn the basics of regex’s syntax. After this short period of learning, it should be useful to you , in your everyday work, without the need to get someone’s help ;-))

    But, if you persist in your attitude, chances are no one will want to help you anymore !



  • @guy038 Thank you for letting me know about this. However, instead I studied this issue that I take the time to do things that other economic benefit of my family. Everyone is different circumstances. If you’re doing one work to care for family, whether you leave work every day then just to learn one topic does not help economic your family?
    Please ignore problems that go, because it is not related to me, to you, and it is not related to the content of the forums about it. The problem here is that I need to know how to delete text at the bottom or at the top in my example stated:

    And how to get this result ??? 

    And this result ???


  • This post is deleted!

  • I’ve used this one, and it worked for me. But there are still residual marks behind: in each line. Is there another way?
    Search :
    Replace with : Blank

  • @Mary-Soifaite ,

    Since the new “@Mary-Soifaite” participant is at least showing a little bit of effort, showing regexes that were tried, I will chime in again.

    if I had text that was split up in three groups, using colon : characters to separate the groups, and wanted to pick one or more of those groups, I would use a generic expression like

    • FIND = (?-is)^([^:]+):([^:]+):([^:]+)$

    which puts the first term in $1, the second in $2, and the third in $3.

    To make it clear, I will use the dummy text


    as my example, though I know that any other characters than : can be in each section

    For the replacement, depending on which words I wanted to keep, I would use

    • REPLACE =
      • $1:$2

      • $1:$3

      • $2:$3


    But whether your name is @Mary-Soifaite or @Sarah-Duong or @PeterJones or @guy038 , the way to learn how to do these things yourself, rather than asking every time and getting impatient when volunteers don’t answer you right away is to spend a few minutes reading the documentation. If it’s important enough to spend time writing up the question, and it’s important enough to spend time writing a response complaining that volunteers don’t reply within 10 minutes of asking the question, then it’s important enough to start learning to do on your own; and the way to do that is to learn from the examples that @Sarah-Duong has already been given in multiple discussions on this forum, and to read the documentation that has been linked in multiple conversations with @Sarah-Duong.

    @Sarah-Duong: to get good answers

    • Show patience: Based on your native language, I am assuming you are in Asia; Guy is in Europe; I am on the West Coast of the United States. Local time is different for each of us. The person who may be best suited to answer your question may not be around during a time that is “convenient” for you. Some of us are here on our local weekends; some are here on our local weekdays; some are here just in our local evening; some come frequently; some come only occasionally. Waiting an hour or two, or a day or two, or even a week for an answer here are all perfectly-reasonable response times. If you complain about how long it’s been (“Where are you all going? This is too much.”), it is annoying to those of us who volunteer our time to help others in the forum. We are not paid for this. We all have other things – family, paying jobs, hobbies – in our lives that compete for our time.

    • Show an effort, show a willingness to learn: that includes making use of what we’ve shown you before, trying to slightly change things as circumstances change; ask questions about why something does or doesn’t work; don’t just tell us “and now, in this other circumstance, give me the answer”. Show what regex you tried: I appreciated that “@Mary-Soifaite” at least posted a regex that had been tried; she didn’t say why she thought it would work, and because she didn’t use backticks like `([a-zA-Z0-9.%+-]+@`, we cannot actually tell what her real regex looked like… but she at least showed something she tried: it shows an effort

    If you feel me rude why are you still answering me

    Because I want you to learn. The only reason I have hung out in this forum for the last four and a half years is because I like helping other people learn how to use this tool. And every once in a while, even in this discussion, you show that you might be willing to learn. You have spent a lot of time in this discussion arguing, and in this and other discussions, you tend to want us to just hand you the answer… but I haven’t given up, and I keep hoping that with the right phrasing, you’ll start asking better questions, and start learning from all the effort we have put into helping you.

  • Hi, @mary-soifaite, @sarah-duong @peterjones, @alan-kilborn and All

    I think that we can generalize the @peterjones’s search regex to any number of fields, with a : separator

    So, let’s suppose that each line of your table contains N + 1 fields, from 0 to N :

    string_0:string_1:string_2: ....... :string_N

    Then the generic regex, below, should work to get, after replacement, any group $i

    SEARCH ^([^:\r\n]+):((?1)):((?1)): ...... :((?1))
                                             N times the regex :((?1))

    So, @mary-soifaite, assuming your example :

    the search regex ^([^:\r\n]+):((?1)):((?1)) and one the 3 replacements, proposed by Peter, should work just nice ;-))

    Best Regards,


    P.S. :

    • The pattern [^:\r\n] represents any standard character, different of a colon

    • So, the pattern [^:\r\n]+ stands for a non-mull range of this character

    • Now, the repeated pattern (?1) is a sub-routine call to group 1 ( [^:\r\n]+). So, a reference to the regex itself and not the present value of group 1 !

    • As each sub-routine call is surrounded by a couple a parentheses, each of them are referenced as group 2, group 3 , and so on … till group N

  • Actually I do not know how to start. Here is my file, I copied one section to let people be able to understand and visualize the problem.

  • I don’t post it here. It report error.

  • alt text
    and I need to get the results:
    alt text
    and results:
    alt text

    hope people understand my

  • Hello, @mary-soifaite,

    Thanks for your different images. And, this confirms that, if we consider the general template :


    You’re expecting two lists :

    • One with STRING_1:STRING_2, so, the first two fields

    • One with STRING_2:STRING_3, so, the last two fields


    • The former list should be obtained with this regex S/R :

      • SEARCH ^([^:\r\n]+):((?1)):((?1))

      • REPLACE $1:$2

    • The later list should be obtained with this regex S/R :

      • SEARCH ^([^:\r\n]+):((?1)):((?1)) ( idem as above)

      • REPLACE $2:$3

    Of course, you must select the Regular expression search mode, tick the Wrap around option and, finally click on the Replace All button !

    Note that, instead of posting some images via an other site, you could have simply pasted the clipboard contents of your text, directly in your post area, by using the usual Ctrl + V shortcut : it’s easier for people to test regexes against your data

    Even better : before pasting your text, click on the </> button, first, in order to insert code text !

    Best regards,


  • it can also be so


Log in to reply