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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Regular Expressions:
regular expression


New User

Sep 24, 2014, 12:35 PM

Post #1 of 3 (38925 views)
regular expression Can't Post

how do i create a regular expression for a nfl players that threw for 3000 or more yards and more than 30 touchdowns.


Name ,team,position,350,541,64.7,33.8,"4434",8.2,277.1,"30",7,197,36.4,83T,55,17,50,103.2

from above i am interested in only 4434 and 30 (one in double "").


Sep 24, 2014, 9:18 PM

Post #2 of 3 (38918 views)
Re: [moneysab] regular expression [In reply to] Can't Post

I doubt that you can. Even if you can, it would be a bad solution to your problem because it is far beyond what regular expressions are intended to do. A range of numeric values is not a 'pattern'.

You have a .csv file. You first have to parse it into columns. Based on your single sample, you could split the line on commas. A better solution is to use a module such as Text::CSV.
Good Luck,

Veteran / Moderator

Sep 24, 2014, 11:22 PM

Post #3 of 3 (38916 views)
Re: [moneysab] regular expression [In reply to] Can't Post

You probably can do it with a regex, but it would be a very very bad idea.
Use a module such as Text::CSV or use split:

my ($distance, $touchdowns) = (split /,/, $string) [7, 10];


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

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