Answer the question
In order to leave comments, you need to log in
How to write a regular expression for the end of a text?
There is a regular expression that finds the url address string pattern = @"www\.(.*)\.(.*)\W";
The problem is that if the message consists only of a link, that is, there are no spaces or line breaks, then the regular expression will not work. How to organize it so that this moment would be taken into account?
Answer the question
In order to leave comments, you need to log in
You can use \b as a word boundary, it also works at the end of the line.
More clumsily, you can use (\W|$).
And what is the language? You * - not greedy, he will not gobble up too much?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question