Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1090191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:20:08+00:00 2026-05-16T23:20:08+00:00

I have a text file patterned like this : 1 textA == this is

  • 0

I have a text file patterned like this :

1 textA == this is textA ==
1.1 textB === this is textB ===
2 textC == this is textC ==
2.1 textD === this is textD ===
2.1.1 textE ==== this is textE ====

Whats the right regex pattern to formatting the text above:

== this is textA ==
=== this is textB ===
== this is textC ==
=== this is textD ===

I already try to perfoming this in vim :

^\w* -> this pattern just changes only textA and textB

I need to detect “.” and any character or words until meet the “=” sign. Any characters behind the “=” sign will be deleted. Thanks in advance for any answers and pointers.


Solution

^.\{-}\ze=

Explanation :

^.   -> started with any single character
\{-} -> matches 0 or more of the preceding atom, as few as possible
\ze= -> Matches at any position, and sets the end of the match there: The previous char  is the last char of the whole match

In human words :

“Find and replace a text started with any single character followed by anything and ended with “=” sign.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:20:08+00:00Added an answer on May 16, 2026 at 11:20 pm
    :%s/^.\{-}\ze=//
    

    For more details on how to design reg.exps in Vim, see :help pattern which is the most useful section help in Vim IMHO.

    :help :g and :help :v could also be of interest to you. You could for example do:

    :g/=/normal! 0dt=
    

    which will emulate you typing 0dt= on each line containing an = sign.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I' ve got a problem with Haskell. I have text file looking like this:
I have a text file that looks like this: [22/Nov/2011 12:57:58] GET /media/js/jquery-1.4.3.min.js HTTP/1.1
I have a regex pattern that searches for words in a text file. How
I have a text file which goes like this : 125 126 127 {
The file under test will have text patterns like this: name1: function(){ }, name2:
I have text file with some stuff that i would like to put into
I have text file with something like first line line nr 2 line three
I have text file, like FILED AS OF DATE: 20090209 DATE AS OF CHANGE:
I have text file with some text information and i need to split this
I have text file with entries like 123 112 3333 44 2 How to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.