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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.