Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

fun with expressions and metacharacters

Posted on 1998-08-30
6
Medium Priority
?
184 Views
Last Modified: 2010-03-05
I need to do a couple of things.  First I need to get all the * 's out of a variable and also any -- , i just need to git rid of them, not replace them.  And also the more difficult of the two i believe, i have a varibable, say, $post, i need to check to see if it has www. something, i need to change that into <a href=www.whatever>www.whatever</a> cause on a chat i need to allow them to show links, html code is normally stripped. So the $post shold remain the same except change www. into <a href.. etc.  Thanks for the help in advance.  Any questions just post.
0
Comment
Question by:idadan
  • 4
  • 2
6 Comments
 

Author Comment

by:idadan
ID: 1204611
Edited text of question
0
 
LVL 85

Expert Comment

by:ozo
ID: 1204612
$variable =~ tr/-*//d;

$post =~ s/(\bwww\.\S+)/<a href=$1>$1</a>/gi;
0
 

Author Comment

by:idadan
ID: 1204613
Talk about your quick 50, thanks so much, exactly what i was looking for.  btw, you forgot a \ before /a on the second one.. it's late, i understand, hehe.  Thanks again.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:idadan
ID: 1204614
Ok Ozo last change you want your 50?....
0
 
LVL 85

Accepted Solution

by:
ozo earned 200 total points
ID: 1204615
$variable =~ tr/-*//d;

$post =~ s|(\bwww\.\S+)|<a href=$1>$1</a>|gi;

#You didn't say how to tell the end of "whatever"
#the above code assumes it ends with a blank character
0
 

Author Comment

by:idadan
ID: 1204616
Thanks for the help, great as always.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question