CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
trimming string

 



qwe
New User

Jan 14, 2010, 5:20 AM

Post #1 of 2 (1873 views)
trimming string Can't Post

Hi,
I have some strings eg. 1:10:1:111#3/2 and I would like to get 1:10:1:111 . What is the best way to remove # and all characters after this with RegExp?

Thank you in advance.


toolic
User

Jan 14, 2010, 5:59 AM

Post #2 of 2 (1870 views)
Re: [qwe] trimming string [In reply to] Can't Post

One way is to use the substitution operator:


Code
$str =~ s/#.*//;


http://perldoc.perl.org/perlop.html

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives