You need to sign in to do that
Don't have an account?
Vijay Nagarathinam
Regular expression issue
Hi All,
What is the purpose of the below regular expression?
string test = '00045304^+453534$!';
system.debug('>>>> Remove leading zero >>'+test.trim().replaceAll('^0+(?!$)', ''));
Thanks,
Vijay
What is the purpose of the below regular expression?
string test = '00045304^+453534$!';
system.debug('>>>> Remove leading zero >>'+test.trim().replaceAll('^0+(?!$)', ''));
Thanks,
Vijay
If you have to remove all special characters from this string, use :
string test = '00045304^+453534$!';
system.debug('>>>> Remove leading zero >>'+test.replaceAll('[^a-zA-Z0-9]', ''));
or
system.debug('>>>> Remove leading zero >>'+test.trim().replaceAll('[0+(?!$)]', ''));
If you have to remove all alphanumeric characters from this string, use :
string test = '00045304^+453534$!';
system.debug('>>>> Remove leading zero >>'+test.replaceAll('[a-zA-Z0-9]', ''));
or
system.debug('>>>> Remove leading zero >>'+test.trim().replaceAll('[^0+(?!$)]', ''));
Thanks,
Ankur Saini
http://mirketa.com