Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

Splitting number

Have the following line:

$line = "Worldpay (12676141)";

This is what I need:
$test="12676141";

and $line has be change to:
$line = "Worldpay (<a href=\"http://www.test.com/test.cgi?test=1&we=2\">12676141</a>)";

How to do that!
0
weversbv
Asked:
weversbv
1 Solution
 
bigbedCommented:
$line =~ s{^(.*?)\((.*?)\)$}{$1 (<a href=\"....\">$2</a>)};
$test = $2;
0
 
webmaster_prodexCommented:
to be exactly get numbers u would need

$line =~ s/(.*)\(([\d]*)\)/$1<a href="some url">$2<\/a>/ig;
$test = $2;
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.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now