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
Iftikar HussainPosted Jun 17, 2013, 8:08 AM
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.
Sunny SharmaPosted Jun 17, 2013, 2:36 AM
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.
Jignesh TrivediPosted Jun 17, 2013, 12:02 AM
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.