Regex to create list in Scrivener does not work

Hello,

I want to achieve the text transform below. The objective is to create a workable list in Scrivener

It is easy to do manually: insert a tab followed by the character :black_small_square: followed by another tab, but as usual with my regexes it does not work.

My regex creates the following as if it does not recognize tabs:

/t▪/t one
/t▪/t three
/t▪/t two

Thanks in advance for your time and help.

image

image

For a tab try \t rather than /t and I'll bet you get what you're after.

1 Like

Thanks very much!

It works perfectly. thanks again.

Which "language" is used in the Keyboard Maestro regex search and replace?

Concerning regex, I often read that the solution depends on the programming language.

The first paragraph in the KM wiki page for regular expressions says:

Keyboard Maestro uses ICU Regular Expressions (aka RegEx or RegExp) which is very similar to PCRE (Perl Compatible Regular Expressions), and you can read their documentation by choosing ICU Regular Expression Reference from the Help menu in Keyboard Maestro.

Refer to the wiki here: Regular Expressions [Keyboard Maestro Wiki]

image

1 Like

Thanks very much.

In the past hours, I discovered another approach.

Tired of reinventing the wheel at a snail's pace, I bought TextSoap which has a large library of text transform regex called "cleaners" which I run via KBM with the AppleScript action and the following script

tell application "textsoapAgent"
	cleanClipboard with "Name of Cleaner here"
end tell

And there are some nice surprises. I work a lot in Scrivener and frequently change my line spacing from 1 to 1.5 and back which is easy with TextSoap but complicated (if I understand correctly) with regex.

image

2 Likes