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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:55:01+00:00 2026-06-14T14:55:01+00:00

I have been tasked with going through a large list of string values, and

  • 0

I have been tasked with going through a large list of string values, and removing any sign of credit cards. So, if, within the string, I find anything that matches (where n = numerical):

nnnn nnnn nnnn nnnn (4 x 4 numerical)
nnnnnnnnnnnnnnnn (16 numerical)
nnnn-nnnn-nnnn-nnnn (Hyphened)
nnnn nnnnnn nnnn (American express?)
nnnnnnnnnnnnnn (AX, no spaces)
nnnn-nnnnnn-nnnn (AX, Hyphened)

I need to replace that part of the string with [CARD NUMBER REMOVED]

So,

"Client called and gave credit card details as 1234123412341234, exp 1201, and will be booked next week"

would become:

"Client called and gave credit card details as `[CARD NUMBER REMOVED]`, exp 1201, and will be booked next week"

I’m thinking RegEx would FIND this, but I have zero regex experience, and there are many patterns. And, how do I replace that portion?

I could write something that iterates through each char and does some rule checking, but that seems hacky.

Any ideas?

I am trying this:

    const string pattern = @"^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$";
    const string replacement = "[CARD DETAILS REMOVED]";
    var rgx = new Regex(pattern);
    string cleansedText = rgx.Replace(UncleansedText, replacement);
    return cleansedText;

But it doesn’t seem to find a match in this:

“1234610008918730^^9-11^^Code 064^”

  • 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-14T14:55:02+00:00Added an answer on June 14, 2026 at 2:55 pm

    Here’s a similar question, but no selected answer. The top voted one however suggested a web site with the following regex:

    \b(?:\d[ -]*?){13,16}\b
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been tasked with going through a number of ColdFusion sites that have
I have been tasked with porting a large Java codebase to the Android platform.
I have been tasked with securing the connection string in an classic ASP application
I've been tasked with going through a database and checking all of the links,
I work for a large company that has adopted sharepoint. I have been tasked
I have been tasked with upgrading a large web application from .net 1.1 to
I am really new to XMl and have been tasked with extracting some values
I have been tasked with converting some scripts referencing an Informix database to be
I have been tasked with refactoring some components that used xmlbeans to now make
I have been tasked to develop an interactive website using java & mysql: using

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.