My code is this:
description = contents.match(/===========(.*?)Wh开发者_StackOverflowat's New in this Version/m)[1].strip
The code runs fine but now everything after the single quote is in blue and I need a single quote to end it. But where would I put it or how would I escape it? I tried putting a backslash before the single quote but that doesn't change anything.
To work around the shortcomings of the Xcode syntax highlighter, you can replace the single quote with the octal escape code for that character:
/===========(.*?)What\047s New in this Version/m
PS. You can also shorten the start of your regex a bit:
/={11}(.*?)What\047s New in this Version/m
You typically use the backslash "\" to escape special characters:
/===========(.*?)What\'s New in this Version/m
It seems to be an XCode bug. You can try and get around it with this:
/===========(.*?)What.s New in this Version/m
# fix here ----------^
精彩评论