Best iOS Regex software (like Text Wrangler)

Ever since learning RegEx I find numerous uses for it. My favorite editor is Text Wrangler (or BBEdit), though Drafts and Google Docs and other programs have support for basic RegEx.

What’s the best RegEx software for doing more advanced searches and replaces on iOS?

I’d be interested in that too! But also: what’s the best way to learn RegEx?

On an iPad --> RegEx knife

On the Web --> https://regex101.com

The best way to learn is to try over and over and over again. :slight_smile:


JJW

What is it beyond “basic” reg ex that you are looking for?

BBEdit/TextWrangler I think still use the PCRE engine for regular expressions.

Drafts uses Javascript for its scripting and so presumably leverages the standard ECMA-262 engine for this.

Workflow uses the ICU engine.

Just for completeness, I believe Reg Ex knife (I have it - great app :smile:) also uses the ICU engine.

I learned from this tutorial site and then doing it over and over.

https://regexone.com

Drafts can handle everything I learned on there, however I found other sites that described other features such as /U and /e tags to uppercase things, /b word delimiters, etc that Drafts doesn’t do.

Perhaps it just uses a different flavor of RegEx. I’m now realizing there are different versions.

Between using Google Sheets (spreadsheet functions) and BBEdit I feel like a text ninja!

I downloaded RegEx knife previously and it looked like a way to write Reg Expressions and see how it works in real time, but not necessarily to apply it to a large chunk of text. I didn’t give it too much exploration, so I’m certain I’m missing something.

Editorial might actually be another choice. It and Pythonista (both from the same developer) use Python and the ‘re’ Python library.

That library is based on Perl’s regular expressions so my suspicion is that it is mostly PCRE compatible.

The regular expression documentation for Editorial has information about what flags and modifiers are supported. This includes the U flag (for unicode) and b flag for word boundaries. In terms of uppercase get you would apply that using other Python based functionality.

Drafts is using ES6 (JavaScript) and the regular expressions should use the flags defined here. You’ll find that compared to PCRE that there are some differences in flags and what can be done, but it is quite capable. Also, like Python in Editorial, you can use the language itself to carry out additional text manipulations that take the functionality beyond pure regular expression processing.

Hope that helps.

A note for completeness…

When scripting in Drafts actions, it does use the JavascriptCore Regex implementation and the ES6 docs should be correct.

When using the Drafts’ find-and-replace features with regular expressions enabled, it’s using NSRegularExpression, the standard Apple Regex implementation, which is documented on Apple’s site.

As far as a personal recommendation for Regex testing, +1 for regex101.com.

2 Likes

:sunglasses:

That was exactly what was recommended by several people for a Mac user over on the Automators forum.