You can test regular expressions against expected data outside of Ignite-UX using grep with the – E70 option:

#cat data

u1

u12

u123

u1234

U1a

U123456

#cat data grep -E "^[[:alpha:]][[:digit:]]+[[:digit:]]$" u12

u123

u1234

U123456

This allows you to have some level of confidence that your regular expression will do what you want it to.

Another example:

( _my_command_c_option ! ~ "^[[:alpha:]][[:digit:]]+[[:digit:]]$root" ) { error+=”The user name must start with letter followed by only digits”

} else {

note+=”The user name chosen was “ + ${_my_command_c_option}

}

The regular expression above adds “root” to one of the previous expressions we’ve looked at, which matches the user root as well as the other users allowed by the expression. Remember that the “” operator means orand allows you to give multiple regular expressions to match against.

Testing this with grep you can see that this does work:

#cat data

u1 root u12 u123 u1234 U1a U123456

#cat data grep -E "^[[:alpha:]][[:digit:]]+[[:digit:]]$root" root

u12

u123

u1234

U123456

70This option is required as it enables extended regular exrepssions in grep so we can test in exactly the same way that Ignite-UX will perform its regular expression matching. Without the –Eoption grep will only use basic regular expression matching. As an alternative to grep –Eyou can just use the egrep command.

146