Jump to content

Recommended Posts


I'm looking for a way to surround selected text with the usual (I think html?) codes for bold, italic and strike (


) with a keyboard shortcut. Nothing fancy nor extensive. 

I understand one can do this with the Transform function in Alfred. Problem is, as far as I understand it would have to be done using a regex? 

I would add my voice to the usual "just learn it", but the maybe twice I've approached regex in my entire life (and I'm no spring chicken) I've felt as if I was trying to climb a mountain to get to a pebble, maybe usual, but not a diamond. 

So, I humbly ask: would anyone with knowledge of the Dark Arts be kind enough to help me? One example of the structure would be great, I think I'm not that dumb that I couldn't adapt to the others. 

Thanks for the generous one(s). 

Share this post

Link to post

That's BBCode, not HTML. HTML would be <b></b>.


Generally, regular expressions are total overkill for just surrounding some text with tags, but that's the only tool Alfred gives you for the job.


You want a Replace utility set up like this:




The regular expression .+ means "one or more of any character", and the brackets mean "this is a match group". In the replacement field, $1 means "contents of match group 1". So basically, "match anything and put it between [ b] and [/b]".

Edited by deanishe

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...