Hi All,
Has any one seen this before?
When i perform a preg_match_all on a html page that contains ´ it breaks out my pregmatch?
eg the html file contains (with the usual html tags and stuff):
drS_name='Panthers Run'
drS_name='Jack´s Lad'
drS_name='Red Jester'
What i'm matching is (?<=drS_name=.).+[a-z] which should return:
Panthers Run
Jack´s Lad
Red Jester
but because of the html ´ its breaking the match out and only returning:
Jack'
Any Ideas anyone?
Thanks,
Slash.
´ breakout?
Moderator: General Moderators
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: ´ breakout?
I get exactly what you expect:
So, there's something wrong with your regex engine, or, more likely, you're doing something wrong or are not getting the string you had expected.
Code: Select all
<?php
$text = "drS_name='Panthers Run'
drS_name='Jack´s Lad'
drS_name='Red Jester'";
preg_match_all('/(?<=drS_name=.).+[a-z]/', $text, $matches);
print_r($matches);
/* output:
Array
(
[0] => Array
(
[0] => Panthers Run
[1] => Jack´s Lad
[2] => Red Jester
)
)
*/
?>Re: ´ breakout?
Hhhmmmm,
Thanks for the reply. I'll try upgrading my version of php see if that helps.
Thanks,
Slash.
Thanks for the reply. I'll try upgrading my version of php see if that helps.
Thanks,
Slash.
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: ´ breakout?
I don't think it's your PHP version.slash85 wrote:Hhhmmmm,
Thanks for the reply. I'll try upgrading my version of php see if that helps.
Thanks,
Slash.
Before making the match, try echo-ing the text you're matching your pattern against. Most likely the text is something other than you expected.