mrobinson
  •  mrobinson
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
2012-07-11T15:48:09Z
I'm trying to set our forums up to replace social security numbers. I have been successful in getting it to replace a 9 digit number but when posted in the normal format 123-45-6789 I can't get replace to work. I'm sure it's a syntax issue I have wrong. Can someone supply me with the proper syntax please?

I'm sure this question has been asked before but my forum searches yielded nothing.

Thanks in advance!!
Mike
Sponsor
squirrel
2012-07-11T15:51:42Z
Make sure you are escaping special characters in the regex, such as the dash. If you don't properly escape any 'reserved' characters, the regex will fail.
If you can't find it using the forum search, try my signature link -- searches this site using Google: Google is my Friend 
mrobinson
  •  mrobinson
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
2012-07-11T15:54:54Z
Wow, fast reply. Much appreciated!!

We just figured it out. Needed to enclose the expression in parenthesis. This one works for 123456789 and 123-45-6789

(\d{3}-\d{2}-\d{4})|\d{9}

Thought I'd list the expression for the next person who might search this post.



Thank you for the help. Issue resolved

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved