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: Beginner: Re: [TotalNoob] How do I do this...: Edit Log



KevinR
Veteran


Jul 2, 2009, 10:52 AM


Views: 4631
Re: [TotalNoob] How do I do this...


In Reply To

In Reply To
I'm pretty sure what you're looking for are called regular expressions. A quick google search should turn up what you're looking for.



Exactly! Thanks :)




In Reply To
I don't understand your initial question though.



Ok I'll try elaborate. I have a text with something like this:

|\.at|\.cx|\.io|\.jp|\.nu|\.st|\.tk|\.ua

I want the file to read .jp but it also read .jpg

So how do I make it only read .jp and only that not ad the g or any other letter after...?

Thanks again!


Assuming that the file extension is at the end of your string you want to add the end of string anchor ($) to your regexp:


Code
/\.(at|cx|io|jp|nu|st|tk|ua)$/


Note how I have used the dot once and created a group that you can check after the dot.
-------------------------------------------------


(This post was edited by KevinR on Jul 2, 2009, 10:52 AM)


Edit Log:
Post edited by KevinR (Veteran) on Jul 2, 2009, 10:52 AM


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

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