lib/phonelib/core.rb in phonelib-0.6.46 vs lib/phonelib/core.rb in phonelib-0.6.47
- old
+ new
@@ -105,9 +105,25 @@
# @return [Boolean] Flag defines whether to do strict parsing check
def strict_check=(strict)
@@strict_check = strict
end
+ # @private sanitizing regex, matching symbols will get removed from parsed number, must be string
+ @@sanitize_regex = '[^0-9]+'
+
+ # getter for sanitize regex
+ # @return [String] regex of symbols to wipe from parsed number
+ def sanitize_regex
+ @@sanitize_regex
+ end
+
+ # setter for sanitize regex
+ # @param regex [String] symbols to wipe from parsed number
+ # @return [String] regex of symbols to wipe from parsed number
+ def sanitize_regex=(regex)
+ @@sanitize_regex = regex.is_a?(String) ? regex : regex.to_s
+ end
+
# @private strict double prefix check for validator, doesn't sanitize number
@@strict_double_prefix_check = false
# getter for strict double prefix check flag
# @return [Boolean] Flag defines whether to do strict double prefix parsing check