Which corresponds to the following character ^. * $ Regexp?

Can someone explain what matches the following regular expression?

^.*$

Thank!

+3
source share
7 answers

Either an entire line or the entire line is used, depending on whether multi-line mode is used .

+21
source

all.

^ is the beginning of the string. 
. is any character. 
* means 0 or more of said characters. 
$ is the end of the string. 

So, this regular expression matches 0 or more characters that start and end a line (that's all).

+15
source

. :

^ : match the beginning of the line
. : match any character except newline
* : match zero or many instances of the match
$ : match the ending of the line 
+2

.

^ . $ . , , .

. . * , 0 . , , , 0.

+1

^= ( ).

.= .

*= . ..

$= ( ).

, , (. this . ).

+1

, ...

0

It looks like it matches everyone, including blank lines. *. * Means that it matches all (period) 0 or more times (*). The ^ and $ elements are redundant if you set the multline flag (not sure what it is in java).

0
source

Source: https://habr.com/ru/post/1758933/


All Articles