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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:28:39+00:00 2026-06-11T00:28:39+00:00

I am looking to find and replace text that is NOT inside of a

  • 0

I am looking to find and replace text that is NOT inside of a tag.

The tags are simple, and follow this pattern:

(<[A-Z_]+>)([^<]+)(</[A-Z_]+>)
  • Group 1: Opening tag
  • Group 2: Tag content
  • Group 3: Closing tag

The text I need to look at is like this (1 line per text item with possibly multiple tags in each line):

What movie did The programmer watch if he didn't watch <NAME>The Office</NAME>?

Where I need to match “The” before “programmer”, but NOT “The” inside of the < NAME > tag. I’m looking to change that to:

What movie did the programmer watch if he didn't watch <NAME>The Office</NAME>?

As another example, perhaps better:

What movie did The programmer watch if he didn't watch <NAME>Dawn of the Dead - The Original Director's Cut</NAME>?

Basically, I’m looking to fix case problems with the text that is outside of a tag. I do not want to touch any text inside of the tag at all. Here’s another example:

Why Don't You watch <NAME>This is Spinal Tap</NAME> on <DAY>Friday</DAY> or whenever?

There, I’d like to find:

  • Don’t
  • You

But not “Spinal”, etc., and end up with this:

Why don't you watch <NAME>This is Spinal Tap</NAME> on <DAY>Friday</DAY> or whenever?

All the strings that I need to look at are sentences with tagged text being placed anywhere inside of the string. No tags overlap or contain another tag.

Any help at all is appreciated. Even just a link or pointer to the right path to run down.

Thanks in advance!

  • 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-11T00:28:41+00:00Added an answer on June 11, 2026 at 12:28 am

    Your solutions is:

    Regex.Replace(s, @"((?<!^)\b[A-Z])(?=[^<>]+<[^\/>][^>]+>)", m => m.Value.ToLower());
    

    Check this demo.

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

Sidebar

Related Questions

I'm looking to replace the text inside a <nobr> but I can't figure out
I'm looking for a way to find/replace links to images (within user-generated content) without
I'm looking to find information on how to update my XCode program that has
I've been looking on google about this but I can't find a clear answer.
I have some text looking like this: My arbitrary content.... ```c# public class Foo
I'm looking for a simple way to delete repeated text in a Word 2007
I was pretty surprised I couldn't find this anywhere online, including stackoverflow. I'm looking
I'm looking for a regular expression to use in Refex.Replace that allows me to
I am looking to find the slope between two vectors via linear regression in
I'm looking to find the add-on which will draw a tooltip window at the

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.