
japhy
Enthusiast
/ Moderator
Aug 24, 2000, 9:20 AM
Post #4 of 4
(1513 views)
|
|
Re: Stripping expression from within HTML
[In reply to]
|
Can't Post
|
|
You'd probably want to use the tr/// operator to remove parentheses: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $str =~ tr/()//d; </pre><HR></BLOCKQUOTE> As for single characters separated by . or a space, I'd use the following: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $str =~ s{ \b # word boundary ( # save to $1 [a-zA-Z] ([\ ]) [a-zA-Z] # a letter followed by '.' or ' ' followed by a letter (?: \2 [a-zA-Z] )* # and 0 or more of that character and a letter ) \b # and a word boundary }{ my $abbrev = $1; # store the whole a.b.c to $abbrev $abbrev =~ s/\Q$2\E//g; # remove the '.' or ' ' $abbrev; # return the new string }gex; </pre><HR></BLOCKQUOTE> ------------------ Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher
|