Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
AnswerRe: i want to accept only numeric value to a textbox in datagridview Pin
thatraja14-Feb-14 4:12
professionalthatraja14-Feb-14 4:12 
GeneralRe: i want to accept only numeric value to a textbox in datagridview Pin
BillWoodruff14-Feb-14 13:54
professionalBillWoodruff14-Feb-14 13:54 
QuestionImpersonation Pin
i gr814-Feb-14 2:17
i gr814-Feb-14 2:17 
QuestionDirtying my hand with regular expression for first time Pin
tasumisra13-Feb-14 18:12
tasumisra13-Feb-14 18:12 
AnswerRe: Dirtying my hand with regular expression for first time Pin
OriginalGriff14-Feb-14 0:01
mveOriginalGriff14-Feb-14 0:01 
GeneralRe: Dirtying my hand with regular expression for first time Pin
tasumisra14-Feb-14 0:25
tasumisra14-Feb-14 0:25 
GeneralRe: Dirtying my hand with regular expression for first time Pin
OriginalGriff14-Feb-14 0:41
mveOriginalGriff14-Feb-14 0:41 
GeneralRe: Dirtying my hand with regular expression for first time Pin
Richard Deeming14-Feb-14 0:43
mveRichard Deeming14-Feb-14 0:43 
Based on your sample data and description, this pattern will match the three PIN numbers:
(?<=(PIN|(PIN\s+\#)|(PIN:)|(PIN NUMBER))\s+)\b[\w\s]{2,5}\b

You can then replace it with "*****" to mask the values:
C#
Regex pinNumberPattern = new Regex(@"(?<=(PIN|(PIN\s+\#)|(PIN:)|(PIN NUMBER))\s+)\b[\w\s]{2,5}\b", RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);

string input = @"FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN 12345 ADDLINE1.....
FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN # 12345 CITY.....
FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN: 123 5 COUNTRY.....
FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN NUMBER ADDLINE1.....";

string output = pinNumberPattern.Replace(input, "*****");

/*
output contains:
FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN ***** ADDLINE1.....
FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN # ***** CITY.....
FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN: ***** COUNTRY.....
FIRSTNAME Tasu LASTNAME Mishra DOB 02011982 PIN NUMBER ADDLINE1.....
*/




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


AnswerRe: Dirtying my hand with regular expression for first time Pin
tasumisra14-Feb-14 0:53
tasumisra14-Feb-14 0:53 
QuestionConcepts about Generics Pin
Richard Andrew x6413-Feb-14 8:23
professionalRichard Andrew x6413-Feb-14 8:23 
AnswerRe: Concepts about Generics Pin
Richard Deeming13-Feb-14 8:47
mveRichard Deeming13-Feb-14 8:47 
GeneralRe: Concepts about Generics Pin
Richard Andrew x6413-Feb-14 8:59
professionalRichard Andrew x6413-Feb-14 8:59 
QuestionWho can help me with this C# Project. Pin
horoz07413-Feb-14 7:05
horoz07413-Feb-14 7:05 
AnswerRe: Who can help me with this C# Project. Pin
Matt T Heffron13-Feb-14 7:15
professionalMatt T Heffron13-Feb-14 7:15 
GeneralRe: Who can help me with this C# Project. Pin
horoz07413-Feb-14 7:20
horoz07413-Feb-14 7:20 
QuestionRe: Who can help me with this C# Project. Pin
thatraja13-Feb-14 7:29
professionalthatraja13-Feb-14 7:29 
AnswerRe: Who can help me with this C# Project. Pin
horoz07413-Feb-14 7:32
horoz07413-Feb-14 7:32 
GeneralRe: Who can help me with this C# Project. Pin
thatraja13-Feb-14 7:47
professionalthatraja13-Feb-14 7:47 
QuestionDropDownlist keeps disappearing Pin
vkEE13-Feb-14 5:47
vkEE13-Feb-14 5:47 
SuggestionRe: DropDownlist keeps disappearing Pin
Richard MacCutchan13-Feb-14 7:03
mveRichard MacCutchan13-Feb-14 7:03 
QuestionOut of Memory error while generating TreeView Pin
Member 768043413-Feb-14 2:04
Member 768043413-Feb-14 2:04 
AnswerRe: Out of Memory error while generating TreeView Pin
Dave Kreskowiak13-Feb-14 2:35
mveDave Kreskowiak13-Feb-14 2:35 
AnswerRe: Out of Memory error while generating TreeView Pin
Eddy Vluggen13-Feb-14 2:59
professionalEddy Vluggen13-Feb-14 2:59 
AnswerRe: Out of Memory error while generating TreeView Pin
BillWoodruff13-Feb-14 3:24
professionalBillWoodruff13-Feb-14 3:24 
QuestionNumericString Sort Pin
Member 1059316812-Feb-14 20:52
Member 1059316812-Feb-14 20:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.