Solved

fun with expressions and metacharacters

Posted on 1998-08-30
6
177 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 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

760 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now