Reputation: 1965
My code is this:
description = contents.match(/===========(.*?)What'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.
Upvotes: 1
Views: 1095
Reputation: 14881
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
Upvotes: 1
Reputation: 34308
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 ----------^
Upvotes: 0
Reputation: 46965
You typically use the backslash "\" to escape special characters:
/===========(.*?)What\'s New in this Version/m
Upvotes: 0