in reply to Re: Re: A regex question with 2 pieces of data
in thread A regex question with 2 pieces of data

Just use Abigail-II's regex (courtesy of Regexp::Common) to pull them out of your data. If $data contains your data you want to get the numbers from, then something like
my ($one, $two) = ($data =~ /($RE{num}{decimal}).*?($RE{num}{decimal})/);
will put the first two numbers, regardless of what they are, into $one and $two. (Make sure to use Regexp::Common; in your script though before using the regex above!)

Replies are listed 'Best First'.
Re: Re: Re: Re: A regex question with 2 pieces of data
by diotalevi (Canon) on Apr 08, 2003 at 00:54 UTC

    And at some point here it the /s regex switch will be required if there are newlines in the data because dot doesn't match newline normall.y

Re: Re: Re: Re: A regex question with 2 pieces of data
by Anonymous Monk on Apr 08, 2003 at 01:05 UTC
    How do I put the Regexp:Common library on my server? Do I just include it as Common.pm in the CGI directory? The server is hosted by someone else. Please advise.
      You could manually download the file and put it in the CGI directory like you said, but the preferred way would be to download the gzipped tarball, extract the contents and run
      perl Makefile.PL LIB=/your/perl/lib PREFIX=/your/perl/lib make make test make install
      Replace the path after LIB= and PREFIX= with where you want it installed (probably in some directory in your home). In the script wher e you plan to use the module, make sure to do a use lib '/your/perl/lib'; to add the path to @INC.

      Also, if you asked, the sysadmin would probably install it site-wide as it is a common and very useful module.

      Update Added the PREFIX and use lib ... bits which I forgot before.