473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Regex with LWP won't work... Help

60
it's an example. I want a script to print the real url behind a lix.in one
so i tried these:

Expand|Select|Wrap|Line Numbers
  1. use LWP::UserAgent;
  2.  
  3. use LWP::UserAgent;
  4. my $ua = new LWP::UserAgent;
  5.  
  6. my $response = $ua->post('http://lix.in/53fe67',{ tiny => '53fe67', submit => 'continue',});
  7. my $con = $response->content; 
  8.  
  9. my $con = ~/<p><p><form action="(.*)" method="post">/;
  10. print "$1\n";
the $con variabe is ok, i mean if i print it, it shows the content but the regex won't work. the PRINT $1 show nothing


p.s: lix.in is used to protect rapdishare.com links


the usefull part in the content to get the rapidshare URL is here:
Expand|Select|Wrap|Line Numbers
  1. ...
  2. <p><p><form action="http://rs71.rapidshare.com/files/24716102/CBRv6CB.rar" method="post">
  3. You want to download the file <b>http://rapidshare.com/files/24716102/CBRv6CB.rar</b><br><table id="premiumtable" cellpadding="5" cellspacing="0">
  4. ...
May 2 '07 #1
3 2102
miller
1,089 Expert 1GB
Hi pplers,

Remove the "my" from your regex statement.

Expand|Select|Wrap|Line Numbers
  1. if ($con =~ /<p><p><form action="(.*)" method="post">/) {
  2.     print "$1\n";
  3. } else {
  4.     print "No Match Found";
  5. }
  6.  
- Miller
May 2 '07 #2
KevinADC
4,059 Expert 2GB
might also need to "s" modifier on the end of the regexp:

Expand|Select|Wrap|Line Numbers
  1. if ( $con =~ /<p><p><form action="(.*)" method="post">/s )

$con must be a multi line scalar, adding "s" will tell the regexp to treat it as one line.
May 2 '07 #3
pplers
60
thanks to both

it worked great xD
May 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
4
by: H | last post by:
This is kind of an followup on oneof my previous questions, and it has with RegEx to do. I have a string containing of several words. What would a good regex expression looklike to get one match...
16
by: Andrew Baker | last post by:
I am trying to write a function which provides my users with a file filter. The filter used to work just using the VB "Like" comparision, but I can't find the equivilant in C#. I looked at...
7
by: Razzie | last post by:
Hey all, Decided to give a shot at Regular expressions - need a bit of help :) I can't seem to find the right regex for matching words like "*test*" or *somevalue*" - in short, all words...
7
by: melanieab | last post by:
Hi, I'm trying to use DataView to find the row number in the datatable that contains "Rich" in it so that I can highlight it. It works fine when I enter the entire string (i.e. Richard), but I...
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
6
by: Extremest | last post by:
I have a huge regex setup going on. If I don't do each one by itself instead of all in one it won't work for. Also would like to know if there is a faster way tried to use string.replace with all...
5
by: =?Utf-8?B?SkF1bA==?= | last post by:
I am currently working on a project and need to get a return… even if that return is a failure. I must also add that I have no control over either the Regular Expression that will be used or the...
7
by: Chuck B | last post by:
In a C# Regex expression which would be faster when run against say 10,000 strings: Regex(@"\d+/\d+/\d+ The quick brown fox.*"); or Regex(@"\d+/\d+/\d+ The.*"); The reason I'm asking is...
5
by: Sean | last post by:
I am finally taking the time to get to know regex, but it seems I have taken a bit of a tumble. I have the following (dummy) data: <td>Name:</td <td>Kherie Kali</td> If I use this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.