SPUG: regex problems...

Ken McGlothlen mcglk at serv.net
Fri Oct 1 14:30:43 CDT 1999


"Sean" <seanow0 at email.msn.com> writes:

| If I say:
| 
| $snip='<a href="http://blah.foo.com/index.htm" class="style"';
| $code =~ s/$snip/[replacement/gsi;
| 
| And
| $code =~ s/<a href="http://blah.foo.com/index.htm" =
| class="style"/[replacement/gsi;
| 
| I know example 2 is wrong and I need to escape a few characters, but why =
| won't example 1 work?

Well, I assume that the pesky "[" character is *not* in your actual code (in
general, it's best to include actual code rather than pseudocode).

In fact, could you post the actual code, plus the actual line in the text
you're attempting to replace?

							---Ken

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list