Skip to content

Sinoffate/regex_assignment_483

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust

Rust Validation Project

This project demonstrates the usage of user input and regular expressions in Rust. It includes various functions for validating and parsing different types of inputs such as Social Security Numbers, US phone numbers, email addresses, and more.

Prerequisites

To get started, you'll need to have the following software installed on your computer:

The installation process will install the Rust compiler, Cargo, and the Rust standard library. The dependencies will differ depending on your operating system.

For Windows, you can use the Windows Subsystem for Linux to run the project on a Linux environment (Which will be the easier option than running natively).

# Install pre-reqs
sudo apt install build-essential 

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Getting Started

These instructions will help you set up the environment and run the project on your local machine.

# Navigate to the project root directory   
# To build the project we use Cargo:
  cargo build

# then run the project with:
  cargo run

# Running Tests
# To run the unit tests for the validation functions, use the following command:
  cargo test

# This command will run all the tests defined in the tests module and outputting the results and time in seconds to complete the tests.

Functions

This project includes the following functions for validation and parsing:

  • validate_ssn: Validates US Social Security Numbers.
  • validate_phone_number: Validates US phone numbers and will reformat them to ensure readability.
  • validate_email: Validates email addresses.
  • validate_name: Validates names on a class roster.
  • validate_date: Validates dates in MM-DD-YYYY format.
  • validate_address: Validates US house addresses.
  • validate_city_state_zip: Validates the city, state, and zip code format for a letter.
  • validate_military_time: Validates military time without colons.
  • validate_currency: Validates US currency amounts down to the penny.
  • validate_url: Validates URLs with optional "http://" or "https://".
  • validate_password: Validates passwords with specific requirements.
  • validate_odd_ion_words: Validates words containing an odd number of alphabetic characters and ending in "ion".

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages