Reg. Expressions - seperating

I am trying to seperate my expression below:

$password2 =~ tr/[a-i][j-r][s-z]/[0-9][a-i][0-7]/;

For example

a-i will be replaced with 0-9
j-r will be replaced with a-i

With the code above it is placing it in the database with the [ ]

Any ideas?
LVL 1
catonthecouchproductionsAsked:
Who is Participating?
 
TintinConnect With a Mentor Commented:
You need to change your expression to:

$password2 =~ tr/a-ij-rs-z/1-9a-i1-7/;
0
 
Kim RyanIT ConsultantCommented:
You do not neet the brackets. Also I think you may need to split this out into 3 tr statements, one for each set
$password2 =~ tr/a-i/0-9/;
0
 
catonthecouchproductionsAuthor Commented:
If I did that would I do:

$password2 =~ tr/a-i/0-9/;
$password2 .=~ tr/a-i/0-9/;

But change expression up?
0
 
catonthecouchproductionsAuthor Commented:
Thank you for your help! Gotta love expressions....haha

Ryan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.