in reply to Possible with a regex?
Note: try using m{...} instead of m/.../ anytime you want to have a regex that contains forward slashes. That way you don't have to escape them:
my $test = qq| sdfiojs pfojsdfs fs [img]sdj fpsdofj spojf sfsf [b] [img]http://www.te +st.com/image.gif[/img] dfs fs s fsf sfd [img]test.gif[/img] |; while ($test =~ m{\[img\]([^\[\]]*)\[/img\]}g) { print "$1\n"; }
|
|---|