PDA

View Full Version : Regular Expression Help


bpoppa
12-23-2003, 04:48 PM
This may seem simple but I am fried at this point.



I have a string that has an exmaple value of ST02P1. I need to get the first 2 letters (ST) in its own variable.



I have tried numerous methods.



I appreciate any help!



Jim

Jeff Mott
12-23-2003, 10:16 PM
my $variable = substr 'ST02P1', 0, 2;

dswimboy
12-31-2003, 07:00 PM
and for future reference:

$return = substr(string value, zero-based initial position, length of substring);