SANJIESAN WORLDJOURNAL / COLLECTIONS / SANJIESAN
SANJIESANTOOLS

SANJIESAN TOOLS / AI-assisted text rules

Give a suggested regex examples it must not match

A suggested regular expression that finds one sample is not yet a useful rule. Write what must match and what must stay unchanged before trying a pattern from a chat or tutorial. Use harmless text, specify the application or language and inspect the matched span. A partial match can answer a different question from validating the whole field.

Create a small acceptance table

For an invented resource label, list two allowed examples and several near misses: missing separator, extra suffix and unexpected spaces. State whether matching is case-sensitive and whether the entire string matters. Write these decisions independently of the proposed expression. Do not use a broad pattern as a substitute for deciding the naming rule. Keep real email addresses, secrets and private records out of the sample set and any public discussion.

Check the engine and the matched span

MDN’s guide describes JavaScript regular expressions; that scope does not make its syntax universal across every search tool. Read the target tool’s documentation before borrowing a feature. Inspect the exact returned substring or positions for every example. A search finding the allowed label inside a longer forbidden value is a failure if your rule requires the whole field. Keep matching separate from a later replacement so an unexpected match does not immediately alter a working file.

Keep the failing example when revising

When a candidate fails, save the smallest example that shows the problem and say what outcome was expected. Compare the revision against the whole small table, including examples that previously passed. Avoid announcing a general validator from a handful of cases. Record the intended input scope and unresolved edge cases with the pattern. No expression was executed or performance measured for this article; it describes a bounded review that should precede using a generated rule.

Sources & further reading

LET’S MAKE WHAT COMES NEXT

Have a product, a resource or an idea?

For suppliers, creators and brands. Tell us what you have in mind and where you work.

Start a conversation ↗