I\'m wondering is there a symbol for any number (including zero) of any characters
Yes, there is one, it's the asterisk: *
a* // looks for 0 or more instances of "a"
This should be covered in any Java regex tutorial or documentation that you look up.
You can use this regular expression (any whitespace or any non-whitespace) as many times as possible down to and including 0.
[\s\S]*
This expression will match as few as possible, but as many as necessary for the rest of the expression.
[\s\S]*?
For example, in this regex [\s\S]*?B
will match aB
in aBaaaaB
. But in this regex [\s\S]*B
will match aBaaaaB
in aBaaaaB
.
I would use .*
. .
matches any character, *
signifies 0 or more occurrences. You might need a DOTALL switch to the regex to capture new lines with .
.
.*
.
is any char, *
means repeated zero or more times.
Do you mean
.*
.
any character, except newline character, with dotall mode it includes also the newline characters
*
any amount of the preceding expression, including 0 times