Topic awaiting preservation: Perl REGEX problem (Page 1 of 1) |
|
---|---|
Maniac (V) Mad Scientist From: Jacks raging bile duct.... |
posted 07-16-2003 17:52
I have a perl script where I want to search for strings in HTML like: |
Maniac (V) Mad Scientist From: 127 Halcyon Road, Marenia, Atlantis |
posted 07-16-2003 20:20
I can't see why it shouldn't work... |
Maniac (V) Mad Scientist From: Jacks raging bile duct.... |
posted 07-16-2003 20:46
It's not working either Petskull. Here's the whole script maybe having context of the rest of the script will play a role in the troubleshooting. code: #!/usr/bin/perl
|
Maniac (V) Mad Scientist with Finglongers From: Cell 53, East Wing |
posted 07-16-2003 20:59
I;m not sure if it is significant but it says: quote:
code: $outline =~ s/<tab.*>/<table>\n/gi;
|
Maniac (V) Mad Scientist From: Jacks raging bile duct.... |
posted 07-16-2003 21:51
LOL did you guys notice that the non breaking space above wasn't escaped.... |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-16-2003 22:49
Um I don't get it this works for me. |
Maniac (V) Mad Scientist From: Jacks raging bile duct.... |
posted 07-16-2003 23:19
I don't get it either...it's friggin driving me crazy |
Paranoid (IV) Inmate From: Madison, Indiana, USA |
posted 07-17-2003 18:06
Does the <table ....> tag span more than one line? code: <table
|
Paranoid (IV) Inmate From: Minneapolis, MN, USA |
posted 07-17-2003 18:28
Yes, you will want to change all your regexps. Remember they are greedy by default, so .*> will match everything up to the last >. The only reason any of them work right now is because you don't have the 's' modifier at the end of the regexp, so it is doing one line at a time. |
Maniac (V) Mad Scientist From: Jacks raging bile duct.... |
posted 07-17-2003 18:58
Hey neighbor...I live in West Lafayette, Indiana! |
Maniac (V) Mad Scientist From: 127 Halcyon Road, Marenia, Atlantis |
posted 07-18-2003 06:06
hey--- could you post or email me the entire script? |
Maniac (V) Mad Scientist From: Jacks raging bile duct.... |
posted 07-18-2003 14:32
Here's what I have so far...some of it works and some of it doesn't...as far as the substitutions go...everything else with the script is flawless. code: #!/usr/bin/perl
|
Maniac (V) Mad Scientist From: 127 Halcyon Road, Marenia, Atlantis |
posted 07-21-2003 02:03
how about a typical infile that you would use? |
Maniac (V) Mad Scientist From: Jacks raging bile duct.... |
posted 08-07-2003 17:57
In order to fix the problems I'm been having with line breaks I strip out all \n at the beginning of my script an add them back in later to fix formatting. I've read that this is a really common practice among Perl programmers. |
Paranoid (IV) Inmate From: California |
posted 08-08-2003 15:45
One thing you might consider doings is reading in the entire file before you run it through your regexes: code: use Fcntl qw/:flock/;
|