Java regular expression “( *|)”: what does the pipe do? [duplicate]

Pipe (‘|’) simply means ‘or’. At the one side we have regex for zero or more spaces, on the other side we have nothing – so it will match zero or more spaces or an empty string.

Leave a Comment