I am creating a regular expression to match the string
@servername:port:databasename
and through https://regex101.com/ I came up with
\@(((\w+.*-*)+)?\w+)(:\d+)(:\w+)
which matches
e.g. @CORA-PC:1111:databasename or @111.111.1.111:111:databasename
However when I use this regular expression to pattern match in my java code the String @CORA-PC:1111:database=name is also matched.
Why is \w matching the = equals sign? I also tried [0-9a-zA-Z] but it also matched the = equals sign?
Can anyone help me with this? Thanks!
Aucun commentaire:
Enregistrer un commentaire