For one NSString
, I have 2 pattern strings. I want to extract substrings which match the pattern. The string format is like "@Realname![username]"
and I want to separate Realname
and username
and then put these two strings in an array.
EDIT: I'd also like to search this particular substring from a bigger string which will be like "just about any @Realname![username] text which can be typed blah blah..."
Also, There can be as many substrings in the string of the same format and the string can have any characters including "@", "!", "[" or "]"
Sample string: "just about any @Realname1![username1] text which can be @Realname2![username2] typed blah blah..."