I am trying to get all regexp matching the following:
/* anything could be in here */
I have not used regular expressions in swift before. I would imagine it should look something like
var regexpPattern = "\/\*.*\*\/"
var regexp = try NSRegularExpression(pattern: regexpPattern, options: []);
var regexpMatches = regexp.matches(in: THESTRING, options: .anchored, range: NSRange(location: 0, length: THESTRING.characters.count))
However i get the error "invalid escape sequence in literal". I am a little confused as how to use this since i need to provide the pattern in a String. Other languages i used have regexp delimiters, is there such a thing here?
Thanks for taking the time.
EDIT: Solved by Wiktor Stribiżew. Needed to add an extra backslash to escape the backslash.I had originally done that however the real reason i was not receiving any results was because i was using .anchored in the options.