Jump to content

How do I correctly use Replace with regex expression on {query}?


Recommended Posts

Hi, I'm trying to make simple workflow that will use universal actions on an URL to do a "site:URL" search in a search engine.

 

I saw there already is an universal action "Use Domain from URL...", but don't know how to invoke that when making the workflow so Instead I'm looking at Replace action using a regex expression (/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img). Problem is it's not doing anything on the query even though I tested it. 

 

If I input "https://www.alfredapp.com/help/workflows/utilities/replace/" I get the same out. See screenshot.image.png.adf8e62b25c787da5080d6a9547651d7.png

Link to comment
34 minutes ago, nesdroc said:

I saw there already is an universal action "Use Domain from URL...", but don't know how to invoke that when making the workflow


I don’t understand the question.

 

35 minutes ago, nesdroc said:

Problem is it's not doing anything on the query even though I tested it.


The regex goes in the first field, not the second. That’s for what it will be replaced with.

 

This looks like an XY Problem. Please explain what is the goal of the Workflow (not just one step) so we can best help you.

Link to comment

Goal: I want to pass an url in and get only the domain out. 

 

E.g. by selecting https://www.alfredapp.com/help/workflows/utilities/replace/ and running the workflow I would expect to get https://www.alfredforum.com as the result (which I then intend to do a search with). However, it's the same thing coming out.

1712207330_Screenshot2022-07-16at02_15_34.thumb.png.9bf86c2ececb46e90819e5e1310f160c.png

Right now I'm just trying to get the first part to work - the regex part. However, if you know how I can make use of this "Use Domain from URL..." within a workflow then of course that would be easier.

1203941503_Screenshot2022-07-16at02_19_37.png.5dcc4e24a634d7225045f016f00ed67d.png

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...