C# Regex - only match if substring exists?
问题 Ok, so I think I've got a handle on negation - now what about only selecting a match that has a specified substring within it? Given: This is a random bit of information from 0 to 1. This is a non-random bit of information I do NOT want to match This is the end of this bit This is a random bit of information from 0 to 1. This is a random bit of information I do want to match This is the end of this bit And attempting the following regex: /(?s)This is a random bit(?:(?=This is a random).)*