Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Regular
Expressions
101
Regular
Expressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(\S*) && (\1[\.\[]).+
/
gm
Input 1
1
New
// Optional chaining for Javascript is now in stage 4: // https://github.com/tc39/proposal-optional-chaining // WARNING: This is NOT native to JS yet, so you will need to use a babel plugin to convert it: // https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining // Which means you can use this regex to find where in your codebase you can replace this: user && user.profile && user.profile.email // with this: user?.profile?.email // these should match because they have an object variable being accessed multiple times with a dot or opening bracket data && data[query] && data[query].items && data[query].items.length > 0 const street = user.address && user.address.street; // this should not match because they're not accessing the same object data && form.user && api.authenticated