# What does [\S\s]* mean in regex in PHP?

PHPServer Side ProgrammingProgramming

The regular expression [\S\s]* in PHP means “don’t match new lines”.

In PHP, the /s flag can be used to make the dot match all the characters −

## Example

Live Demo

print(preg_match('/^[\S\s]\$/s',"hello \n world"));

## Output

This will produce the following output −

0

The ‘preg_match’ function is used to match regular expression with the given input string. Here since the ‘\’ is encountered, it returns 0.

Published on 09-Apr-2020 11:17:12