x(?=y) - Соответствует 'x' только если за 'x' следует 'y'. Это называется упреждение (источник).
select
sum(amount)
from
records
where
user_id = 1
and date_trunc('month', date) = date_trunc('month', to_date('2021-05-03', 'YYYY-MM-DD'));
// Java9+
var integers = Pattern.compile("-?\\d+").matcher(source)
.results() // Stream<MatchResult>
.map(MatchResult::group) // Stream<String>
.map(Integer::valueOf)
.toArray(Integer[]::new);
// Java8
Integer[] integersJ8 = Pattern.compile(",")
.splitAsStream(source)
.map(String::trim)
.map(Integer::valueOf)
.toArray(Integer[]::new);
const onFocus = (event: React.FocusEvent<HTMLDivElement>) => {
event.currentTarget.classList.add("ticket--focus")
}
const onBlur = (event: React.FocusEvent<HTMLDivElement>) => {
event.currentTarget.classList.remove("ticket--focus")
}
const arr = ['name', 'age', 'surname'] as const;
type arrKeys = typeof arr[number]
const obj: {[k in arrKeys]?: any} = {}
const prepareFn = (key: arrKeys) => { obj[key] };
prepareFn('name')
// @ts-expect-error
prepareFn('name2')
obj.name
// @ts-expect-error
obj.name2