- by nb
I'm currently using regular expressions to search through RSS feeds to find if certain words and phrases are mentioned, and would then like to extract the text on either side of the match as well. For example:
String = "This is an example sentence, it is for demonstration only"
re.search("is", String)
I'd like to know where the is was found so that I can extract and output something like this:
1 match found: "This is an example sentence"
I know that it would be easy to do with splits, but I'd need to know what the index of first character of the match was in the string, which I don't know how to find