omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Regex Select Phrase Not Between Brackets

    Editorial
    2
    4
    2193
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • realburch
      realburch last edited by

      I have a block of text that looks like the below:

      I need you to take a look at Bug 123 and Bug 2345. Also see the list below:

      1. Bug 333
      2. Bug 444
      3. Bug 555

      My workflow successfully insert markdown links for the referenced bugs through the use of the repeat block set to use each match of a regular expression. The resulting text looks like:

      I need you to take a look at [Bug 123](www.bug.com?id=123) and [Bug 2345](www.bug.com?id=2345). Also see the list below:

      1. [Bug 333](www.bug.com?=333)
      2. [Bug 444](www.bug.com?=444)
      3. [Bug 555](www.bug.com?=555)

      My question is, if I want to run the workflow again, how can I prevent it from trying to rewrap matches that already have links.

      The regex pattern I am using (?<![)\bBug\s\d+\b(?!]), and although online python regex testers say the syntax is correct in only identifying Bug #'s not in brackets, it is not working in my workflow.

      Thanks in advance

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        Could you post the workflow you're using? Btw, normal workflow actions (i.e. not scripts) use Cocoa regular expressions, not Python's.

        1 Reply Last reply Reply Quote 0
        • realburch
          realburch last edited by

          Gotcha. The workflow is posted here.

          1 Reply Last reply Reply Quote 0
          • realburch
            realburch last edited by

            Nevermind I see what I did wrong.

            I was naming my link tooltips the same name as the original text, which the workflow was then picking up on subsequent run throughs. the regex was fine.

            I ended up just renaming the tooltips to something generic, but I could have also ignored Bug phrases wrapped in quotes.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors