I am trying to work with pre-determined links within a string, and while my regex works to replace the pre-determined links, I can't add them to an array to work with them.
Here's my code...
I also tried a foreach loop with the array, and nothing is showing up.
What I want to do is take the pre-determined links (surrounded by brackets) and create redirect links using a database, so I need to work with each link rather than just replace it with pre-determined text. At least, I think this is the best approach.
I'm not receiving any errors, just a blank page. Which, the page is completely blank except for the output when it shows up.
Any help would be appreciated.
Here's my code...
Code:
$mystring = qq{ Hello,
My name is red, and I am red like a barn.
[URL unfurl="true"]http://www.example.com[/URL]
This is text to test this out with.
[URL unfurl="true"]http://example.com[/URL]
These words to represent more text fill.
[[URL unfurl="true"]http://example.com?this=good&other=bad1234[/URL]]
That's it... bye...
};
# this works
#$mystring =~ s/(\[http:\/\/)?(\.?\w+-*\w+)+\.(com|net|org|gov|edu|info)\/*[^\s]*\]/link/gi;
#print "$mystring"; exit;
#this works
@array = $mystring =~ m/\d/g; # or \W \w, etc
print @array;
# this doesn't work
#@array = $mysting =~ m/(\[http:\/\/)?(\.?\w+-*\w+)+\.(com|net|org|info|biz)\/*[^\s]*\]/gi;
#print @array; exit;
I also tried a foreach loop with the array, and nothing is showing up.
What I want to do is take the pre-determined links (surrounded by brackets) and create redirect links using a database, so I need to work with each link rather than just replace it with pre-determined text. At least, I think this is the best approach.
I'm not receiving any errors, just a blank page. Which, the page is completely blank except for the output when it shows up.
Any help would be appreciated.