Regular Expression doesn't match

Posted by dododedodonl on Stack Overflow See other posts from Stack Overflow or by dododedodonl
Published on 2010-05-01T17:20:20Z Indexed on 2010/05/01 17:27 UTC
Read the original article Hit count: 192

Hi All,

I've got a regular expression in my cocoa-touch app (using RegexKitLite).

    NSString *week = [[NSString alloc] initWithFormat:@"%@", [pageContent stringByReplacingOccurrencesOfRegex:@"<select name=\"week\" class=\"selectbox\" style='width:134' onChange=\"doDisplayTimetable(NavBar, topDir);\">(.+?)<option value=\"(.+?)\">(.+?)</option>" 
                                                                                               withString:@"$2"]];

I expect it to match with the section of this (what is in NSString pageContent):

  <span class="selection">
   <nobr>
    Periode<br>
    <span class="absatz">
     &nbsp;<br>
    </span>
    <select name="week" class="selectbox" style='width:134' onChange="doDisplayTimetable(NavBar, topDir);">
<option value="14">17-5 - 16-7</option>
    </select>
   </nobr>
  </span>

But it doesn't... I need the value of the option, it is possible that there is more than one (in that case I need them both separated by a ,.

Can someone help me out?

Regards, Dodo

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about iphone-sdk-3.0