Forum Discussion
Mike_Finney_119
Nimbostratus
Sep 06, 2013iRule regex to normalize phone numbers?
Been searching but no luck so far looking for a iRule with a regex or some other method to normalize phone numbers from AD for use to pass to an SMS gateway.
I have adapted the method here: https://...
Kevin_Stewart
Employee
Sep 09, 2013Indeed:
% set num1 "123-456-7890"
% time { regsub -all {\D} $num1 "" } 10000
3.172 microseconds per iteration
% time { string map {"." "" " " "" "-" "" "(" "" ")" ""} $num1 } 10000
1.1674 microseconds per iteration
So then it's really a trade-off between speed and flexibility. Regex will catch more anomalies (ie. "123foo456bar7890") at the expense of CPU time. That said, the goal here was convert a string during access policy evaluation, which should only happen once per session.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects