Jump to content

Regular expression wont work on a longer string?


dbo

Recommended Posts

I'm trying to parse some data out of a large HTML string. When I try this with the full HTML document it fails to find a match yet if I take a paragraph (which contains the search string) and hard code this block I'm able to find a match.

 

Is there an issue with searching large strings or am I missing something?

I believe it was the multiline problem, though I didn't use the m modifier. Perhaps I'll experiment more. Ultimately what I ended up doing was making my search pattern a bit more generic by using .* in a couple of places to eat whatever may exist.

 

If that's the case then add the 's' modifier to include newlines instead of .*, which is what I think you're doing.

 

http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.