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 8082647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:11:07+00:00 2026-06-05T17:11:07+00:00

I am looking for a single regular expression that will replace all replace me

  • 0

I am looking for a single regular expression that will replace all replace me in the text with REPLACE ME, but will leave dont replace me untouched.

Text sample:

blah replace me blah
blah dont replace me blah
replace me blah blah
blah blah dont replace me

I know it can be done an infinite number of ways, but I am looking for a solution utilizing single regex search and replace, so post only if you have one 🙂

I think it can be done using information from this site: http://www.regular-expressions.info/refadv.html, but I get lost when I read about atomic grouping, lookarounds etc.

I will upvote any solution that works and accept the nicest one. Thanks in advance.

EDIT: could you also explain the idea behind the regex when you post one? Would be nice for people that are not very familiar with the syntax.

You can test your regexes here: http://www.regextester.com/. I am not sure if it is not limited though…

  • 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-05T17:11:10+00:00Added an answer on June 5, 2026 at 5:11 pm

    In python/perl/c#:

    (?<!dont )replace me
    

    In vim:

    :%s/\(dont \)\@<!replace me/REPLACE ME/g
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The text is: Here is some text! The regular expression (looking for a single
I'm looking for a regular expression that allows for either single-quoted or double-quoted strings,
What I am looking for is to mimic behavior of C# regular expression (that
I'm looking for a regular expression in Java which matches all whitespace characters in
I am looking for a regular expression using preg_match_all in PHP 5 that would
I'm looking for a single regular expression for our password requirements. Passwords: Must be
I am looking for a single MYSQL script to convert ALL column names in
Looking around, I can't name a single web application (not web service) that uses
I was looking to override only a single TextField in the Django admin but
I'm looking for a control that allows me to choose a single option from

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.