Solved

fun with expressions and metacharacters

Posted on 1998-08-30
6
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 

Author Comment

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

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
Industry Leaders: 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 84

Accepted Solution

by:
ozo earned 50 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

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!

Question has a verified solution.

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

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

726 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