Error preg match function preg-match Unknown modifier in raptr php on line 14

0 votes

I'm currently working on parsing an RSS feed. I've gotten the data I need no problem, and all I have left is parsing the game title.

Here is the code I currently have (ignore the sloppiness, it is just a proof of concept):

<?php
$url = 'http://edureka.co';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$result = curl_exec($ch); 
curl_close($ch);

$xml = new SimpleXMLElement($result);

$lastgame = $xml->channel->item[0]->description;
preg_match('[a-zA-Z]+</a>.$', $lastgame, $match);

echo $match;
?>

Everything was working great, but then I started getting this error:

Warning: preg_match() [function.preg-match]: 
Unknown modifier '+' in raptr.php on line 14

The only thing I have left is to strip out the closing anchor tag and the period, but I can't seem to figure out why it isn't liking the '+'. Any ideas?

Nov 23, 2020 in PHP by kartik
• 37,520 points
2,323 views

1 answer to this question.

0 votes

Hello,

Try this code:

preg_match('/[a-zA-Z]+<\/a>.$/', $lastgame, $match);
print_r($match);

Using / as a delimiter means you also need to escape it here, like so: <\/a>.

answered Nov 23, 2020 by Niroj
• 82,840 points

Related Questions In PHP

0 votes
0 answers
0 votes
1 answer

Invalid argument supplied for foreach() on line 25. Error in my php and mysql

Hello @viven , This should be a simple fix ...READ MORE

answered Aug 4, 2020 in PHP by Niroj
• 82,840 points
4,303 views
0 votes
1 answer
0 votes
1 answer

Error:Undefined index: barangay in C:\xampp\htdocs\TextBlast\homepage\insert.php on line 22

Hello @ Regina, First checks whether a variable is ...READ MORE

answered Aug 14, 2020 in PHP by Niroj
• 82,840 points
5,778 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
23,295 views
0 votes
1 answer

How to make Bootstrap popover Appear/Disappear on hover instead of click?

Hello @kartik, Set the trigger option of the popover to hover instead ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,840 points
3,313 views
0 votes
1 answer

How to enable Bootstrap tooltip on disabled button?

Hii @kartik, You can wrap the disabled button ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,840 points
5,102 views
0 votes
1 answer

Error: cannot call methods on button prior to initialization; attempted to call method 'loading'

Hii @kartik, It's caused by jquery-ui and bootstrap-button ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,840 points
6,565 views
0 votes
1 answer

Error:PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

Hello @kartik, 8388608 bytes is 8M, the default ...READ MORE

answered Sep 17, 2020 in PHP by Niroj
• 82,840 points
28,540 views
0 votes
1 answer

Fatal error: Call to undefined function ImageCreate() in /home/t1g01/phplot.php on line 248

Hello @kartik, Your server most like does not ...READ MORE

answered Nov 18, 2020 in PHP by Niroj
• 82,840 points
6,267 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP