Solved

fun with expressions and metacharacters

Posted on 1998-08-30
6
179 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

809 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