-
specifies a range of characters in a regular expression. To get what you want, "escape" the -
with
; e.g.:
C:> 'XXX_YYYY-UUUU_fff.xxx' -split '[_-.]'
XXX
YYYY
UUUU
fff
xxx
i.e., split the string using any of the following characters: _
, -
, or .
.
You can also tell the regular expression parser that the -
is a literal character in the set by placing it at the beginning of the set just after the [
or at the end of the set by placing it just before the ]
, as in:
[-_.]
or
[_.-]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…