Regular Expressions 101

Community Patterns

1...56789...901

Community Library Entry

7

Regular Expression
ECMAScript (JavaScript)

/
if\s*\((.+?)\)\s*{(.*?)}\s*?(else\s*?if\s*?\((.+?)\)\s*?{.*?})?\s*?(else\s*?{(.*?)})?
/

Description

matches full if condition statment eg: if(condition){ ... } else if(condition){ ... }else{ ... }

Submitted by Ivan Jakesevic - 10 years ago