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

  • Home
  • SEARCH
  • 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 8254155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:06:07+00:00 2026-06-08T01:06:07+00:00

What regex pattern should I use to find two strings with a similar value

  • 0

What regex pattern should I use to find two strings with a similar value on successive lines

For example, if I have something like:

(NOTE: the following values are already indented in the front)

    end
    end

how would I search for this using the vi editor?

EDIT

I would like it to match "    end" and "    end" or "  end" and "  end"
  • 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-06-08T01:06:08+00:00Added an answer on June 8, 2026 at 1:06 am

    Since you mentioned that the values are indented… you can use this pattern to overcome that issue:

    /end\n\s*end

    The \s stands for whitespace, meaning it can be either a tab or a space. The * means there can be none or infinite of the preceding character (in this case, whitespace). If you wanted to just match two spaces you could use /end\n end or /end\n\s\send. If you want to match four you could similarly type them all out or do /end\n\s\{4}end to only match 4 whitespace characters (space or tab).

    I think what you’d really like to do is match identical lines. So you can do /\(^.*$\)\n\1 to accomplish that. If you want a certain number of identical lines you could do /\(^.*$\)\(\n\1\)\{15} (this example uses 15 but you can change that to any number you’d like or switch \{15} with * for any matches.

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

Sidebar

Related Questions

I'm trying to use regex to match digits in java, something like: Pattern p
My regex pattern looks something like <xxxx location=file path/level1/level2 xxxx some=xxx> I am only
Taking the following string example, what is the pattern I should use to extract
Lets say i have some regex = ..(group1)..|..(group2).. pattern.matcher(regex) matcher.find() // how can i
I have got this regex pattern that works with my current apache log format:
I want a regex pattern to find all the words of this format [xyzblab23la].
could someone help me with the regex pattern that i could use to match
I need to retrieve a regex pattern matched strings from the given input. Lets
I am looking for a regex pattern I want to use in my php
I have a big log file, over 1 million lines. I need to use

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.