Prerequisites
Make sure you have installed LocalRegex in your project before continuing.Validate mobile numbers
LocalRegex provides multiple methods for validating Zimbabwean mobile numbers:
Use
LocalRegex.isZimMobile() when you need to validate any Zimbabwean mobile number regardless of the provider. For international numbers, use LocalRegex.isValidMobile().Validate national IDs and other documents
Validate various Zimbabwe-specific identification documents:
Validate emails and other common patterns
LocalRegex also supports validation for common patterns like emails, URLs, and passwords:
Format phone numbers
Convert phone numbers between different formats using the
formatNumber() extension method:The
formatNumber() method automatically handles phone numbers with spaces, dashes, or parentheses by cleaning them before formatting.Complete example
Here’s a complete example that demonstrates multiple validation and formatting features:Next steps
Now that you understand the basics, explore more advanced features:Mobile number validation
Learn about all mobile number validation methods
Document validation
Validate IDs, passports, licenses, and number plates
Phone number formatting
Advanced phone number formatting options
VoIP validation
Validate VoIP numbers from various providers