Major change to matching syntax

There’s something that has been bugging me for quite some time: the fact that the Name and Site fields default to regular expressions (regex) syntax. Most people don’t know, don’t care, and don’t need regex, so it’s annoying that if they want to match a field using a CSS selector, they have to type \[type="submit"\] instead of [type="submit"] because square brackets are reserved regex characters that need to be “escaped” (most people don’t know this, nor should they be expected to).

Starting with the next major update (v12.18.0 v13.0.0), the matching syntax for the Name and Site fields will be plain text, so you won’t need to remember to escape certain characters with a backslash anymore (good riddance!). However, regex is not going away—we’re going to try and give you the best of both worlds, so power users can continue to use regex if they need that flexibility. Here’s how it’s going to work for the Name and Site fields (as well as the Exceptions tab):

  • If you enter abc, it performs a plain text partial match on attribute values; if not found, it switches to a CSS selector match.
  • If you enter "abc", it performs a plain text exact match (similar to most search engines) on attribute values.
  • If you enter /abc/, it performs a regex match (as it does now) on attribute values.
  • If you enter //abc, it performs an XPath match.

What does this mean for you? This is a bit tricky because all of your autofill rules are currently using regex syntax, but the problem is they are not surrounded by /. This could be a disaster after you update, as Lightning Autofill would try to do a plain text match for a rule like ^firstname$, which would not match any attribute value, resulting in most of your rules failing. :see_no_evil:

Umm… so how do you plan to solve this? 😅

We will implement two things:

  1. After the update to v12.18.0 v13.0.0, Lightning Autofill will automatically update all rules so that the Name and Site values (and lines in Exceptions) are wrapped in /. This takes care of the data you have loaded currently, but what about the data you keep in CSV files and Google Sheets? That’s where part two comes in…

  2. We will add additional logic in the import function so that if the imported data has a timestamp older than when you received the update, it will also update the Name/Site/Exceptions fields as described in part one.

These two solutions should ensure a smooth migration for the vast majority of users, but we expect there to be a tiny percentage of people who may encounter issues (Murphy’s Law dictates this). The good news is that if your autofill rules break in v12.18.0 v13.0.0, it’s pretty straightforward to fix: either convert your Name/Site/Exceptions values to regex syntax by wrapping them with /, or convert them to plain text by removing the regex special characters.