Link to home
Start Free TrialLog in
Avatar of robocop100
robocop100

asked on

Perl string parsing

I have a string:

$str = 'JSESSIONID=ABC123; path=/path';

how do I extract 'ABC123' into a new variable?
ASKER CERTIFIED SOLUTION
Avatar of jeromee
jeromee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of farzanj
Try this:

$str =~ /.*=(.*?);.*/;
$var = $1;