Donate

Regular Expression Remove String With A Punctuation Beside It In A Sentence In C#

Assuming in a sentence, you want to remove the word apply now in any case. This word has a punctuation beside it.
Example:
Apply now!
Apply now.
APPLY NOW!
APPLY NOW.
apply Now!
apply Now.
In a sentence:
We are in need of VB.NET Developers. Apply Now!
We are in need of VB.NET Developers. Apply now!
We are in need of VB.NET Developers. APPLY NOW!
We are in need of VB.NET Developers. apply now!
To remove, just use the code below:
description = Regex.Replace(description, "apply now[!.]",   string.Empty,RegexOptions.IgnoreCase).Trim();

Note: I'm not a Regex expert.

Comments

  1. kuya greg..

    AYA here..

    share lang kog link.. hahha
    http://www.iknowryt.com/2011/09/15/effective-asp-net-training-by-cedf-it/

    ReplyDelete
  2. Cge,

    Sabagay,asp.net man sad ang topic...Related pud sa blog...hehehehe... :-D

    ReplyDelete

Post a Comment

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.