Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crates/oxc_regular_expression/src/ast_impl/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub struct RegexUnsupportedPatterns {
pub named_capture_groups: bool,
pub unicode_property_escapes: bool,
pub look_behind_assertions: bool,
pub pattern_modifiers: bool,
}

/// Check if the regular expression contains any unsupported syntax.
Expand Down Expand Up @@ -62,7 +63,12 @@ fn term_contains_unsupported(term: &Term, unsupported: &RegexUnsupportedPatterns
}
disjunction_contains_unsupported(&group.body, unsupported)
}
Term::IgnoreGroup(group) => disjunction_contains_unsupported(&group.body, unsupported),
Term::IgnoreGroup(group) => {
if group.modifiers.is_some() && unsupported.pattern_modifiers {
return true;
}
disjunction_contains_unsupported(&group.body, unsupported)
}
_ => false,
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_transformer/src/regexp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl<'a, 'ctx> RegExp<'a, 'ctx> {
look_behind_assertions,
named_capture_groups,
unicode_property_escapes,
pattern_modifiers: false,
},
}
}
Expand Down
Loading