Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如果中间有文本,如何在断言后面嵌套?_Objective C_Regex_Json_Screen Scraping - Fatal编程技术网

Objective c 如果中间有文本,如何在断言后面嵌套?

Objective c 如果中间有文本,如何在断言后面嵌套?,objective-c,regex,json,screen-scraping,Objective C,Regex,Json,Screen Scraping,我试图使用正则表达式来匹配前面有特定单词的文本(本例中的单词“slide”和“title”)。我一直在尝试使用look-behind断言并将它们嵌套在另一个断言中,但它似乎不起作用。另一个问题是,在我用来匹配的“幻灯片”和“标题”单词之间还有一些其他文本 我试过: (?<=slide(?<=title\\s=\\s)).*(?=\\\") (?<=title\\s=\\s(?<=slide)).*(?=\\\") (?我同意@MartinR的观点,但要回答regex问题

我试图使用正则表达式来匹配前面有特定单词的文本(本例中的单词“slide”和“title”)。我一直在尝试使用look-behind断言并将它们嵌套在另一个断言中,但它似乎不起作用。另一个问题是,在我用来匹配的“幻灯片”和“标题”单词之间还有一些其他文本

我试过:

(?<=slide(?<=title\\s=\\s)).*(?=\\\")
(?<=title\\s=\\s(?<=slide)).*(?=\\\")

(?我同意@MartinR的观点,但要回答regex问题,那是因为你确实在指定一个不可能的条件。你的意思是


(?你想用正则表达式解析JSON吗?一个合适的JSON解析器,如NSJSONSerialization,将是一个更好的解决方案。顺便说一句,你在问题中所展示的不是JSON。-也许你可以更好地解释你真正想要实现的目标。修复了它,非常感谢。只是使用了NSJSONSerialization,谢谢你的帮助。
slide =                 {
                createdAt = "2013-06-18T20:06:50Z";
                description = "<p>Due to the amount of attention paid to each organization's top prospects and early-round draft picks, many of the game's underrated prospects are perpetually obscured. Most of the time, these prospects are younger players who are housed in the low minors and still require considerable physical projection. At the same time, there are countless prospects on the older side of the age curve who have dipped off the radar due to injury.</p><p>Here's a look at one \"hidden gem\" from each organization who could make a push for the major leagues in the coming years.</p>";
                embedCode = "";
                externalId = "<null>";
                id = 3219926;
                photoHasCropExact = 1;
                photoHasCropNorth = 0;
                primaryPhoto =                     {
                    url = "http://img.bleacherreport.net/img/slides/photos/003/219/926/hi-res-5382332_crop_north.jpg";
                };
                title = "Each MLB Team's 'Hidden Gem' Prospect Fans May Not Know About";
                updatedAt = "2013-06-18T22:26:30Z";
                url = "<null>";
(?<=(?<=title\\s=\\s)slide).*(?=\\\")
(?<=(?<=slide)title\\s=\\s).*(?=\\\")
(?<=foo(?<=bar)).
(?<=(?<=bar)foo).