SPUG: Self referecing URL

jeff saenz jeff at planetoid.net
Fri Sep 22 21:31:03 CDT 2000


what about trying :

$item_text =~ s/(NUM\d+)\s/<A HREF=get_page.pl?cat_num=\1>\1<\/A>/g;

you must esc the closing /a tag, try using \d+ inside the params and move the
\s outside the params, unless you want the space in \1.

HEY, anyone looking for an off-site perl developer/consultant.

marlin wrote:

> I need to detect a catalog number in a text line and reference it to
> another page as a link.
>
> The text is $item_text. I want to swap the number (NUM + some digits)
> with itself as a <A HREF> tag.
>
> I tried...
>
> $item_text =~ s/(NUM.*\s)/<A HREF=get_page.pl?cat_num=\1>\1</A>/g;
> which sort of works except that the closing > after the \1 is ignored,
> that is the tag never closes and the entire line is linked.
>
> I'm missing something.

--
Jeff Saenz
http://www.planetoid.net
jeff at planetoid.net



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list