1

(OSX 13.1) I made a shortcut in Shortcuts called "Text->HTML->Make Italic". Its actions are:

  • Receive Text from Quick Input
  • Replace (.*) with <i>$1</i> in Shortcut Input (use Regular Expressions)
  • Stop and output Updated Text

When I highlight a word and right click to run Services->Text->HTML->Make Italic, the text is transformed to:

<i>a word</i><i></i>

Do I need to do something differently or is this a bug? Thanks!

These are the shortcut settings: shortcut screenshot

5
  • We need to see the actual shortcut to diagnose. Can you please edit your question with screen shot(s) of your shortcut?
    – Allan
    Jan 8, 2023 at 23:46
  • @Allan I added the screenshot, thanks. Is there any other info I should add?
    – piojo
    Jan 9, 2023 at 12:33
  • Perhaps .* is too broad? Might the input include a null character, or line break, which is being treated as a second argument? Also, I know that in Automator, there's a risk of inputs 'multiplying' the output as the chain of actions grows.
    – benwiggy
    Jan 9, 2023 at 13:26
  • I have limited AppleScript experience (I prefer Bash). Just out of curiosity…why do you have “Regular Expression” checked? Regex is a very specific language.
    – Allan
    Jan 9, 2023 at 17:00
  • @Allan () is a match group and .* is a wildcard regular expression. Together they capture (all) text and store it as a match.
    – piojo
    Jan 10, 2023 at 11:26

1 Answer 1

1

By experimenting, I found there is a bug in Shortcuts that means the substitution that changes the end (^) has to come first. After that I can add the starting tag to the beginning. This version works:

new substitution settings

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .