I tried to understand the things you mentioned, and then I checked the package, but it seems the ExternalTokenizer input only accept a data with number type. I am not sure how to pass a custom regex to it.
For example, I wanna highlight texts using the user input, I created a grammar
@top RegexText { regex }
@external propSource regexHighlighting from "./highlight"
@external tokens regexToken from "./tokens" { regex }
@detectDelim
For the token file,
import { ExternalTokenizer } from '@lezer/lr';
import { regex } from './regex.grammar.terms';
export const regexToken = new ExternalTokenizer((input, _stack) => {
input.acceptToken(regex);
});