W
W
wkololo_4ever2014-03-14 14:01:16
Regular Expressions
wkololo_4ever, 2014-03-14 14:01:16

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

3 answer(s)
D
dima_horror, 2014-03-14
@wkololo_4ever

Try
And in general skinte an example of an input line.

L
lattenwald, 2014-03-14
@lattenwald

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?

A
afiskon, 2014-03-15
@afiskon

I don't think I understand what you want, but this memo on regular expressions should help you .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question