static S ai_subst_web_charBasedReplace(S webID, S input) { int n = websMadeInThread(); Web web = assertNotNull("Web not found: " + webID, allWebsByID().getFirst(webID)); WebRelation rel = assertNotNull(web_findRelationNamed(web, "matches")); S pat = web_unquoted(rel.a), input = web_unquoted(rel.b); assertEquals("substitute * => * with *", pat); new Matches m; assertTrue(flexMatchIC(pat, input, m)); S src = $1, var = $3; L terms = unquoteAll(trimAll(splitAtJavaToken(m.get(1), ","))); terms = map(func(S s) { replaceIC(s, var, input) }, terms); ai_postTriple_multi(src, "see:", terms); ret nWebs(websMadeInThread()-n) + " made"; }