Add regex word counter

This commit is contained in:
klotske
2023-01-07 19:33:58 +03:00
parent a18ef5b850
commit 20a734d1e1
@@ -12,7 +12,7 @@ interface TrackedTextboxProps {
}
export const TrackedTextarea = (props: TrackedTextboxProps) => {
const wordCount = props.text.split(" ").length - 1;
const wordCount = (props.text.match(/\w+/g) || []).length;
let progressColor: string;
switch (true) {