Hi,
This code is working for c#. when we are coming to java script it is not working.
regular expression in c#.
string regExp ="^(?!(\d)\1+$)(?!(012345678901|123456789012|234567890123|345678901234|456789012345|567890123456|678901234567|789012345678|890123456789|901234567890)$)(?!\d{9}000$)\d{12}$"
Somebody help me how to convert this into JavaScript.
Please let me now any conversion tool is there.
Thanks in advance.
Regards,
Ranganath Potluri
Loading

Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 16, 2013, 8:02 PM EDT
hi,
I think it use this as it is..
Please refer
http://www.dailycoding.com/Posts/using_regexregular_expressions_in_javascript.aspx
hope this will help you.
Sunny SharmaRank #223 · 11.1K reputationPosted Jun 16, 2013, 10:36 PM EDT
Your Regex is totally fine, you just need to pu it a proper JavaScript syntax:
------------------------------------------
var myregexp = /^(?!(\d)\1+$)(?!(012345678901|123456789012|234567890123|345678901234|456789012345|567890123456|678901234567|789012345678|890123456789|901234567890)$)(?!\d{9}000$)\d{12}$/;
------------------------------------------
Hope it helps!
Mark this as answer if it helps :)
Thanks.
Iftikar HussainRank #423 · 5.9K reputationPosted Jun 17, 2013, 4:08 AM EDT
You can do like below
var regExp = new RegExp("^(?!(\d)\1+$)(?!(012345678901|123456789012|234567890123|345678901234|456789012345|567890123456|678901234567|789012345678|890123456789|901234567890)$)(?!\d{9}000$)\d{12}$");
var result=regExp.test("1234");
Regards,
Iftikar
Remember to click "Mark as Answer" on the post, if it helps you.