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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:08:17+00:00 2026-06-12T19:08:17+00:00

I am trying to replace model => model.Password substring within @Html.DisplayNameFor(model => model.Password) .

  • 0

I am trying to replace model => model.Password substring within @Html.DisplayNameFor(model => model.Password).

Any clue which regex template I have use to?

I have tried \\(.+?\\) Is this correct?

Thank you!

var match = Regex.Match(view, @"@Html.DisplayNameFor(\\(.+?\\))", RegexOptions.IgnoreCase);
if (match.Success)
{

}
  • 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-12T19:08:18+00:00Added an answer on June 12, 2026 at 7:08 pm

    The pattern should be more like:

    @"@Html\.DisplayNameFor\((.+?)\)"
    

    Since you were already using a verbatim string (@""), you shouldn’t have included the double backslashes. Also, the . should have been escaped, and I adjusted the grouping parens to match model => model.Password instead of (model => model.Password).

    And if you’re trying to replace, you may want to just use Regex.Replace directly instead of first Matching it.

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

Sidebar

Related Questions

Trying to use a before_save in my Post model and then regex to replace
I am trying to use Regex.Replace to create a hyperlink. I want to make
Trying to replace any non alpha-numeric characters with a hyphen. Can't see why it
I have been trying to replace a word in a text file with a
I have an EntityDataSource where I'm trying to replace some previous code-behind work. My
I'm trying to replace the default ManyToManyField widget in the Admin to use a
I'm trying to make an AJAX call to a model that I have in
Annoying problem. I am trying to replace all semicolon characters in my Model's description
I'm trying to implement the Railscast 340 that demos how to use DataTables, which
I'm trying to have two autofilling textboxes, one for a phone model - input1

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.