#!/bin/bash
STR="12345A"
REG="[a-z]{0,4}[0-9]{2,8}[A-Z]"
if [[ $STR =~ $REG ]]; then
{0,3} - This specify the preceding character set should be in length 0 upto 3.
{2,8} - This specified the length of character should be in length 2 to 8
=~ - This is how to compare regular expression pattern with a string in bash
No comments:
Post a Comment