Re: need help cleaning up a search



On Jan 26, 8:46 pm, webmas...@xxxxxxxxxxxx (FamiLink Admin) wrote:
Hello all,

I am using the following to pull a search query from a google search:

( my $search1 ) = $url =~ /q=(.*)/;
my $search = (split '&', $search1)[0];

If the search looks at this string:

http://www.google.com/search?hl=en&q=+erika+michelle+barre&btnG=Googl...

Then my search = +erika+michelle+barre

How would I chop off any funny characters (+, %, -, ...) from the front of
the results (and off the end for that mater)

Sometimes there are even +++ before the text I need to get.

Don't re-invent the wheel, URI and URI::QueryParam are core modules.

#!/usr/bin/perl

use strict;
use warnings;

use URI;
use URI::QueryParam;

my $url =
URI->new(q{http://www.google.com/search?hl=en&q=+erika+michelle+barre&btnG=Google+Search});

printf "Search string: '%s'\n", $url->query_param('q');

__END__

-jp

.



Relevant Pages

  • need help cleaning up a search
    ... I am using the following to pull a search query from a google search: ... If the search looks at this string: ...
    (perl.beginners)
  • RE: MSVSTO.Applications.Runtime.IEntryPoint vs multiple verions is
    ... FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean ... at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, ... the assembies ref to error ...
    (microsoft.public.office.developer.automation)
  • Re: FtpWebRequest UploadFile
    ... As for using Uri class ... on using Uri or just string path. ... string in advance, using Uri class ... | Subject: Re: FtpWebRequest UploadFile ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Put document and FileName
    ... If you want to write in Spanish, post SharePoint questions to microsoft.public.es.sharepoint. ... SipaAdmElectIntegracion.SharePointFileUploader.SendRequest(String uri, ... String& webUrl, String& fileUrl) ... public void PutDocument(string uri, bytebFichero, string metaInfo) ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: URL encoding api in Java 1.4.2
    ... reserved characters in URI syntax, ... Append the resulting string to the submission URL, ... dubious about the interaction between x-www-form-urlencoding and URI ...   If the method is "get" and the action is an HTTP URI, ...
    (comp.lang.java.programmer)