Regex to check for new line

php, regex

Solution

simple `\r` `\n` (carriage return and new line)

/[\r\n]/

Problem

I want to check if an if statement is on one line or the next line without a brace like so: ``` if (blah === blah) do something ``` or: ``` if (foo === foo) do something ``` The regex i have currently is ``` /\)(?!.*\{)/ ``` But doesnt work. Anyone have any ideas? To elaborate the only If statement that would not be pulled by this regex is the following: ``` if (foo === bar) { ```

Original source

Related problems