From what I'm experiencing, there seems to be a limit around 1300 characters in a string and around 1200 lines of .replaceAll
. I'm not sure what's the exact limit though.
My code looks like this:
function fixText981area(textarea) {
textarea.value = textarea.value
.replaceAll("{(a.)-(b.)}", "(a.)(b.)")
.replaceAll("{(a.)-(c.)}", "(a.)(b.)(c.)")
.replaceAll("{(a.)-(d.)}", "(a.)(b.)(c.)(d.)")
.replaceAll("{(a.)-(e.)}", "(a.)(b.)(c.)(d.)(e.)")
.replaceAll("{(a.)-(f.)}", "(a.)(b.)(c.)(d.)(e.)(f.)")
.replaceAll("{(a.)-(g.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)")
.replaceAll("{(a.)-(h.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)")
.replaceAll("{(a.)-(i.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)")
.replaceAll("{(a.)-(j.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)")
.replaceAll("{(a.)-(k.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)")
.replaceAll("{(a.)-(l.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(a.)-(m.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(a.)-(n.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(a.)-(o.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(a.)-(p.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(a.)-(q.)}", "(a.)(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)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All("{(b.)-(c.)}", "(b.)(c.)")
.replaceAll("{(b.)-(d.)}", "(b.)(c.)(d.)")
.replaceAll("{(b.)-(e.)}", "(b.)(c.)(d.)(e.)")
.replaceAll("{(b.)-(f.)}", "(b.)(c.)(d.)(e.)(f.)")
.replaceAll("{(b.)-(g.)}", "(b.)(c.)(d.)(e.)(f.)(g.)")
.replaceAll("{(b.)-(h.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)")
.replaceAll("{(b.)-(i.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)")
.replaceAll("{(b.)-(j.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)")
.replaceAll("{(b.)-(k.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)")
.replaceAll("{(b.)-(l.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(b.)-(m.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(b.)-(n.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(b.)-(o.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(b.)-(p.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(b.)-(q.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(b.)-(r.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(b.)-(s.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(b.)-(t.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(b.)-(u.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(b.)-(v.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(b.)-(w.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(b.)-(x.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(b.)-(y.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(b.)-(z.)}", "(b.)(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(c.)-(d.)}", "(c.)(d.)")
.replaceAll("{(c.)-(e.)}", "(c.)(d.)(e.)")
.replaceAll("{(c.)-(f.)}", "(c.)(d.)(e.)(f.)")
.replaceAll("{(c.)-(g.)}", "(c.)(d.)(e.)(f.)(g.)")
.replaceAll("{(c.)-(h.)}", "(c.)(d.)(e.)(f.)(g.)(h.)")
.replaceAll("{(c.)-(i.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)")
.replaceAll("{(c.)-(j.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)")
.replaceAll("{(c.)-(k.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)")
.replaceAll("{(c.)-(l.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(c.)-(m.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(c.)-(n.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(c.)-(o.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(c.)-(p.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(c.)-(q.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(c.)-(r.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(c.)-(s.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(c.)-(t.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(c.)-(u.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(c.)-(v.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(c.)-(w.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(c.)-(x.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(c.)-(y.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(c.)-(z.)}", "(c.)(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(d.)-(e.)}", "(d.)(e.)")
.replaceAll("{(d.)-(f.)}", "(d.)(e.)(f.)")
.replaceAll("{(d.)-(g.)}", "(d.)(e.)(f.)(g.)")
.replaceAll("{(d.)-(h.)}", "(d.)(e.)(f.)(g.)(h.)")
.replaceAll("{(d.)-(i.)}", "(d.)(e.)(f.)(g.)(h.)(i.)")
.replaceAll("{(d.)-(j.)}", "(d.)(e.)(f.)(g.)(h.)(i.)(j.)")
.replaceAll("{(d.)-(k.)}", "(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)")
.replaceAll("{(d.)-(l.)}", "(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(d.)-(m.)}", "(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(d.)-(n.)}", "(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(d.)-(o.)}", "(d.)(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(d.)-(p.)}", "(d.)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f.)}", "(e.)(f.)")
.replaceAll("{(e.)-(g.)}", "(e.)(f.)(g.)")
.replaceAll("{(e.)-(h.)}", "(e.)(f.)(g.)(h.)")
.replaceAll("{(e.)-(i.)}", "(e.)(f.)(g.)(h.)(i.)")
.replaceAll("{(e.)-(j.)}", "(e.)(f.)(g.)(h.)(i.)(j.)")
.replaceAll("{(e.)-(k.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)")
.replaceAll("{(e.)-(l.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(e.)-(m.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(e.)-(n.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(e.)-(o.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(e.)-(p.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(e.)-(q.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(e.)-(r.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(e.)-(s.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(e.)-(t.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(e.)-(u.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(e.)-(v.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(e.)-(w.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(e.)-(x.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(e.)-(y.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(e.)-(z.)}", "(e.)(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(f.)-(g.)}", "(f.)(g.)")
.replaceAll("{(f.)-(h.)}", "(f.)(g.)(h.)")
.replaceAll("{(f.)-(i.)}", "(f.)(g.)(h.)(i.)")
.replaceAll("{(f.)-(j.)}", "(f.)(g.)(h.)(i.)(j.)")
.replaceAll("{(f.)-(k.)}", "(f.)(g.)(h.)(i.)(j.)(k.)")
.replaceAll("{(f.)-(l.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(f.)-(m.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(f.)-(n.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(f.)-(o.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(f.)-(p.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(f.)-(q.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(f.)-(r.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(f.)-(s.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(f.)-(t.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(f.)-(u.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(f.)-(v.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(f.)-(w.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(f.)-(x.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(f.)-(y.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(f.)-(z.)}", "(f.)(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(g.)-(h.)}", "(g.)(h.)")
.replaceAll("{(g.)-(i.)}", "(g.)(h.)(i.)")
.replaceAll("{(g.)-(j.)}", "(g.)(h.)(i.)(j.)")
.replaceAll("{(g.)-(k.)}", "(g.)(h.)(i.)(j.)(k.)")
.replaceAll("{(g.)-(l.)}", "(g.)(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(g.)-(m.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(g.)-(n.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(g.)-(o.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(g.)-(p.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(g.)-(q.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(g.)-(r.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(g.)-(s.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(g.)-(t.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(g.)-(u.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(g.)-(v.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(g.)-(w.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(g.)-(x.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(g.)-(y.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(g.)-(z.)}", "(g.)(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(h.)-(i.)}", "(h.)(i.)")
.replaceAll("{(h.)-(j.)}", "(h.)(i.)(j.)")
.replaceAll("{(h.)-(k.)}", "(h.)(i.)(j.)(k.)")
.replaceAll("{(h.)-(l.)}", "(h.)(i.)(j.)(k.)(l.)")
.replaceAll("{(h.)-(m.)}", "(h.)(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(h.)-(n.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(h.)-(o.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(h.)-(p.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(h.)-(q.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(h.)-(r.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(h.)-(s.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(h.)-(t.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(h.)-(u.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(h.)-(v.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(h.)-(w.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(h.)-(x.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(h.)-(y.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(h.)-(z.)}", "(h.)(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(i.)-(j.)}", "(i.)(j.)")
.replaceAll("{(i.)-(k.)}", "(i.)(j.)(k.)")
.replaceAll("{(i.)-(l.)}", "(i.)(j.)(k.)(l.)")
.replaceAll("{(i.)-(m.)}", "(i.)(j.)(k.)(l.)(m.)")
.replaceAll("{(i.)-(n.)}", "(i.)(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(i.)-(o.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(i.)-(p.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(i.)-(q.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(i.)-(r.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(i.)-(s.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(i.)-(t.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(i.)-(u.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(i.)-(v.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(i.)-(w.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(i.)-(x.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(i.)-(y.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(i.)-(z.)}", "(i.)(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(j.)-(k.)}", "(j.)(k.)")
.replaceAll("{(j.)-(l.)}", "(j.)(k.)(l.)")
.replaceAll("{(j.)-(m.)}", "(j.)(k.)(l.)(m.)")
.replaceAll("{(j.)-(n.)}", "(j.)(k.)(l.)(m.)(n.)")
.replaceAll("{(j.)-(o.)}", "(j.)(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(j.)-(p.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(j.)-(q.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(j.)-(r.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(j.)-(s.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(j.)-(t.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(j.)-(u.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(j.)-(v.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(j.)-(w.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(j.)-(x.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(j.)-(y.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(j.)-(z.)}", "(j.)(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("{(k.)-(l.)}", "(k.)(l.)")
.replaceAll("{(k.)-(m.)}", "(k.)(l.)(m.)")
.replaceAll("{(k.)-(n.)}", "(k.)(l.)(m.)(n.)")
.replaceAll("{(k.)-(o.)}", "(k.)(l.)(m.)(n.)(o.)")
.replaceAll("{(k.)-(p.)}", "(k.)(l.)(m.)(n.)(o.)(p.)")
.replaceAll("{(k.)-(q.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)")
.replaceAll("{(k.)-(r.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)")
.replaceAll("{(k.)-(s.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)")
.replaceAll("{(k.)-(t.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)")
.replaceAll("{(k.)-(u.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)")
.replaceAll("{(k.)-(v.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)")
.replaceAll("{(k.)-(w.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)")
.replaceAll("{(k.)-(x.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)")
.replaceAll("{(k.)-(y.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)")
.replaceAll("{(k.)-(z.)}", "(k.)(l.)(m.)(n.)(o.)(p.)(q.)(r.)(s.)(t.)(u.)(v.)(w.)(x.)(y.)(z.)")
.replaceAll("(a.)", "<p>“(a) </p>\n")
.replaceAll("(b.)", "<p>“(b) </p>\n")
.replaceAll("(c.)", "<p>“(c) </p>\n")
.replaceAll("(d.)", "<p>“(d) </p>\n")
.replaceAll("(e.)", "<p>“(e) </p>\n")
.replaceAll("(f.)", "<p>“(f) </p>\n")
.replaceAll("(g.)", "<p>“(g) </p>\n")
.replaceAll("(h.)", "<p>“(h) </p>\n")
.replaceAll("(i.)", "<p>“(i) </p>\n")
.replaceAll("(j.)", "<p>“(j) </p>\n")
.replaceAll("(k.)", "<p>“(k) </p>\n")
.replaceAll("(l.)", "<p>“(l) </p>\n")
.replaceAll("(m.)", "<p>“(m) </p>\n")
.replaceAll("(n.)", "<p>“(n) </p>\n")
.replaceAll("(o.)", "<p>“(o) </p>\n")
.replaceAll("(p.)", "<p>“(p) </p>\n")
.replaceAll("(q.)", "<p>“(q) </p>\n")
.replaceAll("(r.)", "<p>“(r) </p>\n")
.replaceAll("(s.)", "<p>“(s) </p>\n")
.replaceAll("(t.)", "<p>“(t) </p>\n")
.replaceAll("(u.)", "<p>“(u) </p>\n")
.replaceAll("(v.)", "<p>“(v) </p>\n")
.replaceAll("(w.)", "<p>“(w) </p>\n")
.replaceAll("(x.)", "<p>“(x) </p>\n")
.replaceAll("(y.)", "<p>“(y) </p>\n")
.replaceAll("(z.)", "<p>“(z) </p>\n")
};
function fixtext981() {
let textarea = document.getElementById("textarea3");
textarea.select();
fixText981area(textarea);
}
window.addEventListener('DOMContentLoaded', function(e) {
var area = document.getElementById("textarea3");
var getCount = function(str, search) {
return str.split(search).length - 1;
};
var replace = function(search, replaceWith) {
if (typeof(search) == "object") {
area.value = area.value.replace(search, replaceWith);
return;
}
if (area.value.indexOf(search) >= 0) {
var start = area.selectionStart;
var end = area.selectionEnd;
var textBefore = area.value.substr(0, end);
var lengthDiff = (replaceWith.length - search.length) * getCount(textBefore, search);
area.value = area.value.replace(search, replaceWith);
area.selectionStart = start + lengthDiff;
area.selectionEnd = end + lengthDiff;
}
};
});
<textarea id="textarea3" rows="10">
(a.)
{(a.)-(b.)}
{(a.)-(d.)}
</textarea>
<button onclick="fixtext981();">Generate XML</button>
The snippet above is just a sample. I can't post the complete list because of the 30,000 limit of SO.
The purpose of this tool is let the user input a value in the textarea such as (a.)
or (aa.)
. Upon clicking the Generate XML
button, it will be replace with p tags or some xml tags (xml not included in the sample). This helps them create tags much easier and less confusing. The inspiration behind this workaround I'm using is Emmet, though of course I have no idea how to replicate that system, so I'm just using a simple .replace
function.
Despite its simplicity, it's working as needed. But the problem is, I found out there's a word or line limit in this function that is preventing me to complete the list for (a)-(z), (1)-(100), (A)-(Z), (i)-(xxvi), (I)-(XXVI), (aa)-(zz), and (AA)-(ZZ)
.
I tried some other workaround, which is to split it to multiple functions, but it also has a limit of 3, or it stops working.
onclick="fixtext981();fixtext982();fixtext983();
If there is a limit, does anyone know of a better method to achieve the same result? I'm a newbie to JS (and programming in general) so I have no further idea, but maybe some calculations instead of specifying each item?