in reply to Eugh, regex :(
#!/usr/bin/perl use strict; use warnings; use re "debug"; # will help you understand your regexes my $post_message = '[URL=http://img207.imageshack.us/my.php?image=dsc0 +3598vt7.jpg]' . '[IMG]http://img207.imageshack.us/img207/2964/dsc03 +598vt7.jpg[/IMG][/URL]'; my @fields = $post_message =~ m#\Q[URL=\E([^]]+)\Q][img]\E([^]]+)\Q[/i +mg][/URL]\E#gix; ## ^^^ one or more of not ']' ## should be enough here. print join("\n", @fields, "\n");
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Eugh, regex :(
by ultranerds (Hermit) on Mar 25, 2009 at 11:35 UTC | |
by Anonymous Monk on Mar 26, 2009 at 03:54 UTC |